From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- devtools/server/tests/browser/browser_perf-04.js | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 devtools/server/tests/browser/browser_perf-04.js (limited to 'devtools/server/tests/browser/browser_perf-04.js') diff --git a/devtools/server/tests/browser/browser_perf-04.js b/devtools/server/tests/browser/browser_perf-04.js new file mode 100644 index 0000000000..9fba77d053 --- /dev/null +++ b/devtools/server/tests/browser/browser_perf-04.js @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +/** + * Run through a series of basic recording actions for the perf actor. + */ +add_task(async function () { + const { front, client } = await initPerfFront(); + + // Assert the initial state. + is( + await front.isSupportedPlatform(), + true, + "This test only runs on supported platforms." + ); + is(await front.isActive(), false, "The profiler is not active yet."); + + // Getting the active Browser ID to assert in the "profiler-started" event. + const win = Services.wm.getMostRecentWindow("navigator:browser"); + const activeTabID = win.gBrowser.selectedBrowser.browsingContext.browserId; + + front.once( + "profiler-started", + (entries, interval, features, duration, activeTID) => { + is(entries, 1024, "Should apply entries by startProfiler"); + is(interval, 0.1, "Should apply interval by startProfiler"); + is(typeof features, "number", "Should apply features by startProfiler"); + is(duration, 2, "Should apply duration by startProfiler"); + is( + activeTID, + activeTabID, + "Should apply active browser ID by startProfiler" + ); + } + ); + + // Start the profiler. + await front.startProfiler({ + entries: 1000, + duration: 2, + interval: 0.1, + features: ["js", "stackwalk"], + }); + + is(await front.isActive(), true, "The profiler is active."); + + // clean up + await front.stopProfilerAndDiscardProfile(); + await front.destroy(); + await client.close(); +}); -- cgit v1.2.3