forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1756407 - Make about:restartrequired tests more robust r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D144953
- Loading branch information
Alexandre Lissy
committed
Apr 29, 2022
1 parent
fb36ca3
commit 68da11d
Showing
10 changed files
with
210 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
browser/base/content/test/tabcrashed/browser_aboutRestartRequired.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[DEFAULT] | ||
skip-if = | ||
!debug || !e10s || !crashreporter | ||
support-files = | ||
head.js | ||
prefs = | ||
dom.ipc.processCount=1 | ||
dom.ipc.processPrelaunch.fission.number=0 | ||
|
||
[browser_aboutRestartRequired_basic.js] | ||
[browser_aboutRestartRequired_buildid_false-positive.js] | ||
[browser_aboutRestartRequired_buildid_mismatch.js] | ||
[browser_aboutRestartRequired_buildid_no-platform-ini.js] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
184 changes: 0 additions & 184 deletions
184
browser/base/content/test/tabcrashed/browser_aboutRestartRequired_buildid.js
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
browser/base/content/test/tabcrashed/browser_aboutRestartRequired_buildid_false-positive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use strict"; | ||
|
||
// On debug builds, crashing tabs results in much thinking, which | ||
// slows down the test and results in intermittent test timeouts, | ||
// so we'll pump up the expected timeout for this test. | ||
requestLongerTimeout(2); | ||
|
||
SimpleTest.expectChildProcessCrash(); | ||
|
||
add_task(async function test_browser_crashed_false_positive_event() { | ||
info("Waiting for oop-browser-crashed event."); | ||
|
||
Services.telemetry.clearScalars(); | ||
is( | ||
getFalsePositiveTelemetry(), | ||
undefined, | ||
"Build ID mismatch false positive count should be undefined" | ||
); | ||
|
||
ok(await ensureBuildID(), "System has correct platform.ini"); | ||
setBuildidMatchDontSendEnv(); | ||
await forceCleanProcesses(); | ||
let eventPromise = getEventPromise("oop-browser-crashed", "false-positive"); | ||
let tab = await openNewTab(false); | ||
await eventPromise; | ||
unsetBuildidMatchDontSendEnv(); | ||
|
||
is( | ||
getFalsePositiveTelemetry(), | ||
1, | ||
"Build ID mismatch false positive count should be 1" | ||
); | ||
|
||
await closeTab(tab); | ||
}); |
56 changes: 56 additions & 0 deletions
56
browser/base/content/test/tabcrashed/browser_aboutRestartRequired_buildid_mismatch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use strict"; | ||
|
||
// On debug builds, crashing tabs results in much thinking, which | ||
// slows down the test and results in intermittent test timeouts, | ||
// so we'll pump up the expected timeout for this test. | ||
requestLongerTimeout(2); | ||
|
||
SimpleTest.expectChildProcessCrash(); | ||
|
||
add_task(async function test_browser_restartrequired_event() { | ||
info("Waiting for oop-browser-buildid-mismatch event."); | ||
|
||
Services.telemetry.clearScalars(); | ||
is( | ||
getFalsePositiveTelemetry(), | ||
undefined, | ||
"Build ID mismatch false positive count should be undefined" | ||
); | ||
|
||
ok(await ensureBuildID(), "System has correct platform.ini"); | ||
|
||
let profD = Services.dirsvc.get("GreD", Ci.nsIFile); | ||
let platformIniOrig = await IOUtils.readUTF8( | ||
PathUtils.join(profD.path, "platform.ini") | ||
); | ||
let buildID = Services.appinfo.platformBuildID; | ||
let platformIniNew = platformIniOrig.replace(buildID, "1234"); | ||
|
||
await IOUtils.writeUTF8( | ||
PathUtils.join(profD.path, "platform.ini"), | ||
platformIniNew, | ||
{ flush: true } | ||
); | ||
|
||
setBuildidMatchDontSendEnv(); | ||
await forceCleanProcesses(); | ||
let eventPromise = getEventPromise( | ||
"oop-browser-buildid-mismatch", | ||
"buildid-mismatch" | ||
); | ||
let tab = await openNewTab(false); | ||
await eventPromise; | ||
await IOUtils.writeUTF8( | ||
PathUtils.join(profD.path, "platform.ini"), | ||
platformIniOrig, | ||
{ flush: true } | ||
); | ||
unsetBuildidMatchDontSendEnv(); | ||
|
||
is( | ||
getFalsePositiveTelemetry(), | ||
undefined, | ||
"Build ID mismatch false positive count should be undefined" | ||
); | ||
await closeTab(tab); | ||
}); |
50 changes: 50 additions & 0 deletions
50
browser/base/content/test/tabcrashed/browser_aboutRestartRequired_buildid_no-platform-ini.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"use strict"; | ||
|
||
// On debug builds, crashing tabs results in much thinking, which | ||
// slows down the test and results in intermittent test timeouts, | ||
// so we'll pump up the expected timeout for this test. | ||
requestLongerTimeout(2); | ||
|
||
SimpleTest.expectChildProcessCrash(); | ||
|
||
add_task(async function test_browser_crashed_no_platform_ini_event() { | ||
info("Waiting for oop-browser-buildid-mismatch event."); | ||
|
||
Services.telemetry.clearScalars(); | ||
is( | ||
getFalsePositiveTelemetry(), | ||
undefined, | ||
"Build ID mismatch false positive count should be undefined" | ||
); | ||
|
||
ok(await ensureBuildID(), "System has correct platform.ini"); | ||
|
||
let profD = Services.dirsvc.get("GreD", Ci.nsIFile); | ||
let platformIniOrig = await IOUtils.readUTF8( | ||
PathUtils.join(profD.path, "platform.ini") | ||
); | ||
|
||
await IOUtils.remove(PathUtils.join(profD.path, "platform.ini")); | ||
|
||
setBuildidMatchDontSendEnv(); | ||
await forceCleanProcesses(); | ||
let eventPromise = getEventPromise( | ||
"oop-browser-buildid-mismatch", | ||
"no-platform-ini" | ||
); | ||
let tab = await openNewTab(false); | ||
await eventPromise; | ||
await IOUtils.writeUTF8( | ||
PathUtils.join(profD.path, "platform.ini"), | ||
platformIniOrig, | ||
{ flush: true } | ||
); | ||
unsetBuildidMatchDontSendEnv(); | ||
|
||
is( | ||
getFalsePositiveTelemetry(), | ||
undefined, | ||
"Build ID mismatch false positive count should be undefined" | ||
); | ||
await closeTab(tab); | ||
}); |
Oops, something went wrong.