browser_perf-details-07-bleed-events.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that events don't bleed between detail views.
  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, JsCallTreeView } = panel.panelWin;
  17. yield startRecording(panel);
  18. yield stopRecording(panel);
  19. // The waterfall should render by default, and we want to make
  20. // sure that the render events don't bleed between detail views
  21. // so test that's the case after both views have been created.
  22. let callTreeRendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);
  23. yield DetailsView.selectView("js-calltree");
  24. yield callTreeRendered;
  25. let waterfallSelected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED);
  26. yield DetailsView.selectView("waterfall");
  27. yield waterfallSelected;
  28. once(JsCallTreeView, EVENTS.UI_WATERFALL_RENDERED).then(() =>
  29. ok(false, "JsCallTreeView should not receive UI_WATERFALL_RENDERED event."));
  30. yield startRecording(panel);
  31. yield stopRecording(panel);
  32. let callTreeRerendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);
  33. yield DetailsView.selectView("js-calltree");
  34. yield callTreeRerendered;
  35. ok(true, "Test passed.");
  36. yield teardownToolboxAndRemoveTab(panel);
  37. });