browser_perf-overview-selection-02.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that the graphs' selection is correctly disabled or enabled.
  6. */
  7. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  8. const { UI_ENABLE_MEMORY_PREF } = require("devtools/client/performance/test/helpers/prefs");
  9. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  10. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  11. add_task(function* () {
  12. let { panel } = yield initPerformanceInNewTab({
  13. url: SIMPLE_URL,
  14. win: window
  15. });
  16. let { OverviewView } = panel.panelWin;
  17. // Enable memory to test.
  18. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true);
  19. yield startRecording(panel);
  20. let markersOverview = OverviewView.graphs.get("timeline");
  21. let memoryGraph = OverviewView.graphs.get("memory");
  22. let framerateGraph = OverviewView.graphs.get("framerate");
  23. ok(markersOverview,
  24. "The markers graph should have been created now.");
  25. ok(memoryGraph,
  26. "The memory graph should have been created now.");
  27. ok(framerateGraph,
  28. "The framerate graph should have been created now.");
  29. ok(!markersOverview.selectionEnabled,
  30. "Selection shouldn't be enabled when the first recording started (2).");
  31. ok(!memoryGraph.selectionEnabled,
  32. "Selection shouldn't be enabled when the first recording started (3).");
  33. ok(!framerateGraph.selectionEnabled,
  34. "Selection shouldn't be enabled when the first recording started (1).");
  35. yield stopRecording(panel);
  36. ok(markersOverview.selectionEnabled,
  37. "Selection should be enabled when the first recording finishes (2).");
  38. ok(memoryGraph.selectionEnabled,
  39. "Selection should be enabled when the first recording finishes (3).");
  40. ok(framerateGraph.selectionEnabled,
  41. "Selection should be enabled when the first recording finishes (1).");
  42. yield startRecording(panel);
  43. ok(!markersOverview.selectionEnabled,
  44. "Selection shouldn't be enabled when the second recording started (2).");
  45. ok(!memoryGraph.selectionEnabled,
  46. "Selection shouldn't be enabled when the second recording started (3).");
  47. ok(!framerateGraph.selectionEnabled,
  48. "Selection shouldn't be enabled when the second recording started (1).");
  49. yield stopRecording(panel);
  50. ok(markersOverview.selectionEnabled,
  51. "Selection should be enabled when the first second finishes (2).");
  52. ok(memoryGraph.selectionEnabled,
  53. "Selection should be enabled when the first second finishes (3).");
  54. ok(framerateGraph.selectionEnabled,
  55. "Selection should be enabled when the first second finishes (1).");
  56. yield teardownToolboxAndRemoveTab(panel);
  57. });