mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 1583431 - Test "No Stack Sampling" feature - r=julienw
Differential Revision: https://phabricator.services.mozilla.com/D49234 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
edd497462f
commit
0e19d51a0a
@ -9,6 +9,7 @@ support-files =
|
||||
|
||||
[browser_test_feature_ipcmessages.js]
|
||||
[browser_test_feature_jsallocations.js]
|
||||
[browser_test_feature_nostacksampling.js]
|
||||
[browser_test_feature_preferencereads.js]
|
||||
[browser_test_feature_nativeallocations.js]
|
||||
[browser_test_profile_single_frame_page_info.js]
|
||||
|
@ -0,0 +1,78 @@
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Test the No Stack Sampling feature.
|
||||
*/
|
||||
add_task(async function test_profile_feature_nostacksampling() {
|
||||
if (!AppConstants.MOZ_GECKO_PROFILER) {
|
||||
return;
|
||||
}
|
||||
Assert.ok(
|
||||
!Services.profiler.IsActive(),
|
||||
"The profiler is not currently active"
|
||||
);
|
||||
|
||||
startProfiler({ features: ["threads", "js", "nostacksampling"] });
|
||||
|
||||
const url = BASE_URL + "do_work_500ms.html";
|
||||
await BrowserTestUtils.withNewTab(url, async contentBrowser => {
|
||||
const contentPid = await ContentTask.spawn(
|
||||
contentBrowser,
|
||||
null,
|
||||
() => Services.appinfo.processID
|
||||
);
|
||||
|
||||
// Wait 500ms so that the tab finishes executing.
|
||||
await wait(500);
|
||||
|
||||
// Check that we can get no stacks when the feature is turned on.
|
||||
{
|
||||
const {
|
||||
parentThread,
|
||||
contentThread,
|
||||
} = await stopProfilerNowAndGetThreads(contentPid);
|
||||
Assert.equal(
|
||||
parentThread.samples.data.length,
|
||||
0,
|
||||
"Stack samples were recorded from the parent process' main thread" +
|
||||
"when the No Stack Sampling feature was turned on."
|
||||
);
|
||||
Assert.equal(
|
||||
contentThread.samples.data.length,
|
||||
0,
|
||||
"Stack samples were recorded from the content process' main thread" +
|
||||
"when the No Stack Sampling feature was turned on."
|
||||
);
|
||||
}
|
||||
|
||||
// Flush out any straggling allocation markers that may have not been collected
|
||||
// yet by starting and stopping the profiler once.
|
||||
startProfiler({ features: ["threads", "js"] });
|
||||
|
||||
// Now reload the tab with a clean run.
|
||||
gBrowser.reload();
|
||||
await wait(500);
|
||||
|
||||
// Check that stack samples were recorded.
|
||||
{
|
||||
const { parentThread, contentThread } = await stopProfilerAndGetThreads(
|
||||
contentPid
|
||||
);
|
||||
Assert.greater(
|
||||
parentThread.samples.data.length,
|
||||
0,
|
||||
"No Stack samples were recorded from the parent process' main thread" +
|
||||
"when the No Stack Sampling feature was not turned on."
|
||||
);
|
||||
|
||||
Assert.greater(
|
||||
contentThread.samples.data.length,
|
||||
0,
|
||||
"No Stack samples were recorded from the content process' main thread" +
|
||||
"when the No Stack Sampling feature was not turned on."
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user