browser_perf-overview-render-04.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 do not render when realtime rendering is off
  6. * due to lack of e10s.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { UI_ENABLE_MEMORY_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. const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils");
  13. const { isVisible } = require("devtools/client/performance/test/helpers/dom-utils");
  14. const { setSelectedRecording } = require("devtools/client/performance/test/helpers/recording-utils");
  15. add_task(function* () {
  16. let { panel } = yield initPerformanceInNewTab({
  17. url: SIMPLE_URL,
  18. win: window
  19. });
  20. let { $, EVENTS, PerformanceController, OverviewView } = panel.panelWin;
  21. // Enable memory to test.
  22. Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, true);
  23. // Set realtime rendering off.
  24. OverviewView.isRealtimeRenderingEnabled = () => false;
  25. let updated = 0;
  26. OverviewView.on(EVENTS.UI_OVERVIEW_RENDERED, () => updated++);
  27. yield startRecording(panel, { skipWaitingForOverview: true });
  28. is(isVisible($("#overview-pane")), false, "Overview graphs hidden.");
  29. is(updated, 0, "Overview graphs have not been updated");
  30. yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length);
  31. yield waitUntil(() => PerformanceController.getCurrentRecording().getMemory().length);
  32. yield waitUntil(() => PerformanceController.getCurrentRecording().getTicks().length);
  33. is(isVisible($("#overview-pane")), false, "Overview graphs still hidden.");
  34. is(updated, 0, "Overview graphs have still not been updated");
  35. yield stopRecording(panel);
  36. is(isVisible($("#overview-pane")), true, "Overview graphs no longer hidden.");
  37. is(updated, 1, "Overview graphs rendered upon completion.");
  38. yield startRecording(panel, { skipWaitingForOverview: true });
  39. is(isVisible($("#overview-pane")), false,
  40. "Overview graphs hidden again when starting new recording.");
  41. is(updated, 1, "Overview graphs have not been updated again.");
  42. setSelectedRecording(panel, 0);
  43. is(isVisible($("#overview-pane")), true,
  44. "Overview graphs no longer hidden when switching back to complete recording.");
  45. is(updated, 1, "Overview graphs have not been updated again.");
  46. setSelectedRecording(panel, 1);
  47. is(isVisible($("#overview-pane")), false,
  48. "Overview graphs hidden again when going back to inprogress recording.");
  49. is(updated, 1, "Overview graphs have not been updated again.");
  50. yield stopRecording(panel);
  51. is(isVisible($("#overview-pane")), true,
  52. "overview graphs no longer hidden when recording finishes");
  53. is(updated, 2, "Overview graphs rendered again upon completion.");
  54. yield teardownToolboxAndRemoveTab(panel);
  55. });