browser_timeline-waterfall-background.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests if the waterfall background is a 1px high canvas stretching across
  6. * the container bounds.
  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, waitForOverviewRenderedWithMarkers } = require("devtools/client/performance/test/helpers/actions");
  11. add_task(function* () {
  12. let { panel } = yield initPerformanceInNewTab({
  13. url: SIMPLE_URL,
  14. win: window
  15. });
  16. let { WaterfallView } = panel.panelWin;
  17. yield startRecording(panel);
  18. ok(true, "Recording has started.");
  19. // Ensure overview is rendering and some markers were received.
  20. yield waitForOverviewRenderedWithMarkers(panel);
  21. yield stopRecording(panel);
  22. ok(true, "Recording has ended.");
  23. // Test the waterfall background.
  24. ok(WaterfallView.canvas, "A canvas should be created after the recording ended.");
  25. is(WaterfallView.canvas.width, WaterfallView.waterfallWidth,
  26. "The canvas width is correct.");
  27. is(WaterfallView.canvas.height, 1,
  28. "The canvas height is correct.");
  29. yield teardownToolboxAndRemoveTab(panel);
  30. });