browser_perf-details-render-03-memory-calltree.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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, MemoryCallTreeView } = 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(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED);
  23. yield DetailsView.selectView("memory-calltree");
  24. yield rendered;
  25. ok(true, "MemoryCallTreeView rendered after recording is stopped.");
  26. yield startRecording(panel);
  27. yield stopRecording(panel, {
  28. expectedViewClass: "MemoryCallTreeView",
  29. expectedViewEvent: "UI_MEMORY_CALL_TREE_RENDERED"
  30. });
  31. ok(true, "MemoryCallTreeView rendered again after recording completed a second time.");
  32. yield teardownToolboxAndRemoveTab(panel);
  33. });