browser_perf-details-render-02-js-flamegraph.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 js flamegraph view renders content after recording.
  6. */
  7. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  8. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  9. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  10. const { once } = require("devtools/client/performance/test/helpers/event-utils");
  11. add_task(function* () {
  12. let { panel } = yield initPerformanceInNewTab({
  13. url: SIMPLE_URL,
  14. win: window
  15. });
  16. let { EVENTS, DetailsView, JsFlameGraphView } = panel.panelWin;
  17. yield startRecording(panel);
  18. yield stopRecording(panel);
  19. let rendered = once(JsFlameGraphView, EVENTS.UI_JS_FLAMEGRAPH_RENDERED);
  20. yield DetailsView.selectView("js-flamegraph");
  21. yield rendered;
  22. ok(true, "JsFlameGraphView rendered after recording is stopped.");
  23. yield startRecording(panel);
  24. yield stopRecording(panel, {
  25. expectedViewClass: "JsFlameGraphView",
  26. expectedViewEvent: "UI_JS_FLAMEGRAPH_RENDERED"
  27. });
  28. ok(true, "JsFlameGraphView rendered again after recording completed a second time.");
  29. yield teardownToolboxAndRemoveTab(panel);
  30. });