browser_perf-highlighted.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 the toolbox tab for performance is highlighted when recording,
  6. * whether already loaded, or via console.profile with an unloaded performance tools.
  7. */
  8. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  9. const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  10. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  11. const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils");
  12. add_task(function* () {
  13. let { target, toolbox, console } = yield initConsoleInNewTab({
  14. url: SIMPLE_URL,
  15. win: window
  16. });
  17. let tab = toolbox.doc.getElementById("toolbox-tab-performance");
  18. yield console.profile("rust");
  19. yield waitUntil(() => tab.hasAttribute("highlighted"));
  20. ok(tab.hasAttribute("highlighted"), "Performance tab is highlighted during recording " +
  21. "from console.profile when unloaded.");
  22. yield console.profileEnd("rust");
  23. yield waitUntil(() => !tab.hasAttribute("highlighted"));
  24. ok(!tab.hasAttribute("highlighted"),
  25. "Performance tab is no longer highlighted when console.profile recording finishes.");
  26. let { panel } = yield initPerformanceInTab({ tab: target.tab });
  27. yield startRecording(panel);
  28. ok(tab.hasAttribute("highlighted"),
  29. "Performance tab is highlighted during recording while in performance tool.");
  30. yield stopRecording(panel);
  31. ok(!tab.hasAttribute("highlighted"),
  32. "Performance tab is no longer highlighted when recording finishes.");
  33. yield teardownToolboxAndRemoveTab(panel);
  34. });