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-telemetry-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-telemetry-04.js')
-rw-r--r-- | devtools/client/performance/test/browser_perf-telemetry-04.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_perf-telemetry-04.js b/devtools/client/performance/test/browser_perf-telemetry-04.js new file mode 100644 index 000000000..362b54714 --- /dev/null +++ b/devtools/client/performance/test/browser_perf-telemetry-04.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +/** + * Tests that the performance telemetry module records events at appropriate times. + */ + +const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls"); +const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils"); +const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require("devtools/client/performance/test/helpers/actions"); + +add_task(function* () { + let { target, console } = yield initConsoleInNewTab({ + url: SIMPLE_URL, + win: window + }); + + let { panel } = yield initPerformanceInTab({ tab: target.tab }); + let { PerformanceController } = panel.panelWin; + + let telemetry = PerformanceController._telemetry; + let logs = telemetry.getLogs(); + let DURATION = "DEVTOOLS_PERFTOOLS_RECORDING_DURATION_MS"; + let CONSOLE_COUNT = "DEVTOOLS_PERFTOOLS_CONSOLE_RECORDING_COUNT"; + let FEATURES = "DEVTOOLS_PERFTOOLS_RECORDING_FEATURES_USED"; + + let started = waitForRecordingStartedEvents(panel, { + // only emitted for manual recordings + skipWaitingForBackendReady: true + }); + yield console.profile("rust"); + yield started; + + let stopped = waitForRecordingStoppedEvents(panel, { + // only emitted for manual recordings + skipWaitingForBackendReady: true + }); + yield console.profileEnd("rust"); + yield stopped; + + is(logs[DURATION].length, 1, `There is one entry for ${DURATION}.`); + ok(logs[DURATION].every(d => typeof d === "number"), + `Every ${DURATION} entry is a number.`); + is(logs[CONSOLE_COUNT].length, 1, `There is one entry for ${CONSOLE_COUNT}.`); + is(logs[FEATURES].length, 4, + `There is one recording worth of entries for ${FEATURES}.`); + + yield teardownToolboxAndRemoveTab(panel); +}); |