browser_perf-options-propagate-allocations.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.memory.` prefs propagate to
  6. * the memory actor.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { MEMORY_SAMPLE_PROB_PREF, MEMORY_MAX_LOG_LEN_PREF, UI_ENABLE_ALLOCATIONS_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. // Enable allocations to test.
  18. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true);
  19. Services.prefs.setCharPref(MEMORY_SAMPLE_PROB_PREF, "0.213");
  20. Services.prefs.setIntPref(MEMORY_MAX_LOG_LEN_PREF, 777777);
  21. yield startRecording(panel);
  22. let { probability, maxLogLength } = yield toolbox.performance.getConfiguration();
  23. yield stopRecording(panel);
  24. is(probability, 0.213,
  25. "The allocations probability option is set on memory actor.");
  26. is(maxLogLength, 777777,
  27. "The allocations max log length option is set on memory actor.");
  28. yield teardownToolboxAndRemoveTab(panel);
  29. });