Follow-up to bug 2044390, which fixed the devtools tests that failed in the try jobs run at the time. Standalone and all-mochitest jobs surface four more tests in the same two failure classes. browser_perf-02.js and browser_perf-04.js assert the profiler is inactive before starting it. browser_perf-01.js already stops the startup profiler via ProfilerTestUtils.assertProfilerInactive, and in a shared browser instance it runs first and leaves the profiler stopped for the rest of the folder, hiding these two. Standalone jobs restart the browser per test, so they each start with the profiler active and fail; add the same add_setup call. browser_toolbox_tabsswitch_shortcuts.js and the mozscreenshots browser_devtools.js open the performance panel, whose ProfilerEventHandling.componentWillUnmount issues a stopProfilerAndDiscardProfile request on toolbox close that races the connection teardown and rejects (bug 2044383). Tolerate it with PromiseTestUtils.allowMatchingRejectionsGlobally, like the four toolbox tests fixed in bug 2044390. Differential Revision: https://phabricator.services.mozilla.com/D308218
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
/* 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";
|
|
|
|
const { ProfilerTestUtils } = ChromeUtils.importESModule(
|
|
"resource://testing-common/ProfilerTestUtils.sys.mjs"
|
|
);
|
|
|
|
add_setup(ProfilerTestUtils.assertProfilerInactive);
|
|
|
|
/**
|
|
* 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.getMostRecentBrowserWindow();
|
|
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();
|
|
});
|