browser_perf-details-render-04-memory-flamegraph.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 memory call tree view renders content after recording.
  6. */
  7. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  8. const { UI_ENABLE_ALLOCATIONS_PREF } = require("devtools/client/performance/test/helpers/prefs");
  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, DetailsView, MemoryFlameGraphView } = panel.panelWin;
  18. // Enable allocations to test.
  19. Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true);
  20. yield startRecording(panel);
  21. yield stopRecording(panel);
  22. let rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED);
  23. yield DetailsView.selectView("memory-flamegraph");
  24. yield rendered;
  25. ok(true, "MemoryFlameGraphView rendered after recording is stopped.");
  26. yield startRecording(panel);
  27. yield stopRecording(panel, {
  28. expectedViewClass: "MemoryFlameGraphView",
  29. expectedViewEvent: "UI_MEMORY_FLAMEGRAPH_RENDERED"
  30. });
  31. ok(true,
  32. "MemoryFlameGraphView rendered again after recording completed a second time.");
  33. yield teardownToolboxAndRemoveTab(panel);
  34. });