Skip to content

Commit

Permalink
Bug 1756407 - Make about:restartrequired tests more robust r=gsvelto
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Lissy committed Apr 29, 2022
1 parent fb36ca3 commit 68da11d
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 219 deletions.
6 changes: 0 additions & 6 deletions browser/base/content/test/tabcrashed/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ support-files =
file_contains_emptyiframe.html
file_iframe.html

[browser_aboutRestartRequired_basic.js]
skip-if =
!debug
[browser_aboutRestartRequired_buildid.js]
skip-if =
!debug
[browser_autoSubmitRequest.js]
[browser_launchFail.js]
[browser_multipleCrashedTabs.js]
Expand Down
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]
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"use strict";

const kTimeout = 5 * 1000;
// 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(5);

SimpleTest.expectChildProcessCrash();

add_task(async function test_browser_crashed_basic_event() {
info("Waiting for oop-browser-crashed event.");
Expand All @@ -12,13 +17,15 @@ add_task(async function test_browser_crashed_basic_event() {
"Build ID mismatch false positive count should be undefined"
);

let eventPromise = getEventPromise("oop-browser-crashed", "basic", kTimeout);
await openNewTab(true);
await forceCleanProcesses();
let eventPromise = getEventPromise("oop-browser-crashed", "basic");
let tab = await openNewTab(true);
await eventPromise;

is(
getFalsePositiveTelemetry(),
undefined,
"Build ID mismatch false positive count should be undefined"
);
await closeTab(tab);
});

This file was deleted.

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);
});
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);
});
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);
});
Loading

0 comments on commit 68da11d

Please sign in to comment.