browser_perf-options-enable-framerate-02.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that toggling `enable-memory` during a recording doesn't change that
  6. * recording's state and does not break.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { UI_ENABLE_FRAMERATE_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 } = yield initPerformanceInNewTab({
  14. url: SIMPLE_URL,
  15. win: window
  16. });
  17. let { PerformanceController } = panel.panelWin;
  18. // Test starting without framerate, and stopping with it.
  19. Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false);
  20. yield startRecording(panel);
  21. Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, true);
  22. yield stopRecording(panel);
  23. is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, false,
  24. "The recording finished without tracking framerate.");
  25. // Test starting with framerate, and stopping without it.
  26. yield startRecording(panel);
  27. Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false);
  28. yield stopRecording(panel);
  29. is(PerformanceController.getCurrentRecording().getConfiguration().withTicks, true,
  30. "The recording finished with tracking framerate.");
  31. yield teardownToolboxAndRemoveTab(panel);
  32. });