browser_perf-overview-render-02.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 overview graphs cannot be selected during recording
  6. * and that they're cleared upon rerecording.
  7. */
  8. const { Constants } = require("devtools/client/performance/modules/constants");
  9. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  10. const { UI_ENABLE_MEMORY_PREF } = require("devtools/client/performance/test/helpers/prefs");
  11. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  12. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  13. const { times } = require("devtools/client/performance/test/helpers/event-utils");
  14. add_task(function* () {
  15. let { panel } = yield initPerformanceInNewTab({
  16. url: SIMPLE_URL,
  17. win: window
  18. });
  19. let { EVENTS, OverviewView } = panel.panelWin;
  20. // Enable memory to test.
  21. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true);
  22. yield startRecording(panel);
  23. let framerate = OverviewView.graphs.get("framerate");
  24. let markers = OverviewView.graphs.get("timeline");
  25. let memory = OverviewView.graphs.get("memory");
  26. ok("selectionEnabled" in framerate,
  27. "The selection should not be enabled for the framerate overview (1).");
  28. is(framerate.selectionEnabled, false,
  29. "The selection should not be enabled for the framerate overview (2).");
  30. is(framerate.hasSelection(), false,
  31. "The framerate overview shouldn't have a selection before recording.");
  32. ok("selectionEnabled" in markers,
  33. "The selection should not be enabled for the markers overview (1).");
  34. is(markers.selectionEnabled, false,
  35. "The selection should not be enabled for the markers overview (2).");
  36. is(markers.hasSelection(), false,
  37. "The markers overview shouldn't have a selection before recording.");
  38. ok("selectionEnabled" in memory,
  39. "The selection should not be enabled for the memory overview (1).");
  40. is(memory.selectionEnabled, false,
  41. "The selection should not be enabled for the memory overview (2).");
  42. is(memory.hasSelection(), false,
  43. "The memory overview shouldn't have a selection before recording.");
  44. // Ensure overview keeps rendering.
  45. yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, {
  46. expectedArgs: { "1": Constants.FRAMERATE_GRAPH_LOW_RES_INTERVAL }
  47. });
  48. ok("selectionEnabled" in framerate,
  49. "The selection should still not be enabled for the framerate overview (1).");
  50. is(framerate.selectionEnabled, false,
  51. "The selection should still not be enabled for the framerate overview (2).");
  52. is(framerate.hasSelection(), false,
  53. "The framerate overview still shouldn't have a selection before recording.");
  54. ok("selectionEnabled" in markers,
  55. "The selection should still not be enabled for the markers overview (1).");
  56. is(markers.selectionEnabled, false,
  57. "The selection should still not be enabled for the markers overview (2).");
  58. is(markers.hasSelection(), false,
  59. "The markers overview still shouldn't have a selection before recording.");
  60. ok("selectionEnabled" in memory,
  61. "The selection should still not be enabled for the memory overview (1).");
  62. is(memory.selectionEnabled, false,
  63. "The selection should still not be enabled for the memory overview (2).");
  64. is(memory.hasSelection(), false,
  65. "The memory overview still shouldn't have a selection before recording.");
  66. yield stopRecording(panel);
  67. is(framerate.selectionEnabled, true,
  68. "The selection should now be enabled for the framerate overview.");
  69. is(markers.selectionEnabled, true,
  70. "The selection should now be enabled for the markers overview.");
  71. is(memory.selectionEnabled, true,
  72. "The selection should now be enabled for the memory overview.");
  73. yield teardownToolboxAndRemoveTab(panel);
  74. });