browser_perf-details-05-preserve-view.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 same details view is selected after recordings are cleared
  6. * and a new recording starts.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  10. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  11. const { once } = require("devtools/client/performance/test/helpers/event-utils");
  12. add_task(function* () {
  13. let { panel } = yield initPerformanceInNewTab({
  14. url: SIMPLE_URL,
  15. win: window
  16. });
  17. let { EVENTS, PerformanceController, DetailsView, JsCallTreeView } = panel.panelWin;
  18. yield startRecording(panel);
  19. yield stopRecording(panel);
  20. let selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED);
  21. let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);
  22. yield DetailsView.selectView("js-calltree");
  23. yield selected;
  24. yield rendered;
  25. ok(DetailsView.isViewSelected(JsCallTreeView),
  26. "The js calltree view is now selected in the details view.");
  27. let cleared = once(PerformanceController, EVENTS.RECORDING_SELECTED,
  28. { expectedArgs: { "1": null } });
  29. yield PerformanceController.clearRecordings();
  30. yield cleared;
  31. yield startRecording(panel);
  32. yield stopRecording(panel, {
  33. expectedViewClass: "JsCallTreeView",
  34. expectedViewEvent: "UI_JS_CALL_TREE_RENDERED"
  35. });
  36. ok(DetailsView.isViewSelected(JsCallTreeView),
  37. "The js calltree view is still selected in the details view.");
  38. yield teardownToolboxAndRemoveTab(panel);
  39. });