browser_perf-options-propagate-profiler.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that setting the `devtools.performance.profiler.` prefs propagate
  6. * to the profiler actor.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { PROFILER_BUFFER_SIZE_PREF, PROFILER_SAMPLE_RATE_PREF } = require("devtools/client/performance/test/helpers/prefs");
  10. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  11. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  12. add_task(function* () {
  13. let { panel, toolbox } = yield initPerformanceInNewTab({
  14. url: SIMPLE_URL,
  15. win: window
  16. });
  17. Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 1000);
  18. Services.prefs.setIntPref(PROFILER_SAMPLE_RATE_PREF, 2);
  19. yield startRecording(panel);
  20. let { entries, interval } = yield toolbox.performance.getConfiguration();
  21. yield stopRecording(panel);
  22. is(entries, 1000, "profiler entries option is set on profiler");
  23. is(interval, 0.5, "profiler interval option is set on profiler");
  24. yield teardownToolboxAndRemoveTab(panel);
  25. });