diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/performance/test/browser_perf-recording-notices-04.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/performance/test/browser_perf-recording-notices-04.js')
-rw-r--r-- | devtools/client/performance/test/browser_perf-recording-notices-04.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_perf-recording-notices-04.js b/devtools/client/performance/test/browser_perf-recording-notices-04.js new file mode 100644 index 000000000..067cda9dc --- /dev/null +++ b/devtools/client/performance/test/browser_perf-recording-notices-04.js @@ -0,0 +1,66 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +/** + * Tests that when a recording overlaps the circular buffer, that + * a class is assigned to the recording notices. + */ + +const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); +const { PROFILER_BUFFER_SIZE_PREF } = require("devtools/client/performance/test/helpers/prefs"); +const { pmmLoadFrameScripts, pmmStopProfiler, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils"); +const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); +const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions"); +const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils"); +const { once } = require("devtools/client/performance/test/helpers/event-utils"); + +add_task(function* () { + // Make sure the profiler module is stopped so we can set a new buffer limit. + pmmLoadFrameScripts(gBrowser); + yield pmmStopProfiler(); + + // Keep the profiler's buffer small, to get to 100% really quickly. + Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 10000); + + let { panel } = yield initPerformanceInNewTab({ + url: SIMPLE_URL, + win: window + }); + + let { gFront, EVENTS, $, PerformanceController, PerformanceView } = panel.panelWin; + + // Set a fast profiler-status update interval + yield gFront.setProfilerStatusInterval(10); + + let DETAILS_CONTAINER = $("#details-pane-container"); + let NORMAL_BUFFER_STATUS_MESSAGE = $("#recording-notice .buffer-status-message"); + let gPercent; + + // Start a manual recording. + yield startRecording(panel); + + yield waitUntil(function* () { + [, gPercent] = yield once(PerformanceView, + EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, + { spreadArgs: true }); + return gPercent == 100; + }); + + ok(true, "Buffer percentage increased in display."); + + let bufferUsage = PerformanceController.getBufferUsageForRecording( + PerformanceController.getCurrentRecording()); + ok(bufferUsage, 1, "Buffer is full for this recording."); + ok(DETAILS_CONTAINER.getAttribute("buffer-status"), "full", + "Container has [buffer-status=full]."); + ok(NORMAL_BUFFER_STATUS_MESSAGE.value.indexOf(gPercent + "%") !== -1, + "Buffer status text has correct percentage."); + + // Stop the manual recording. + yield stopRecording(panel); + + yield teardownToolboxAndRemoveTab(panel); + + pmmClearFrameScripts(); +}); |