mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1338241 - Part 4: Add tests for dragging browsers into new windows, r=smaug
MozReview-Commit-ID: XwwrAbeyhy
This commit is contained in:
parent
108e36d2e0
commit
68c95714ca
@ -345,8 +345,46 @@ function* largeAllocSuccessTests() {
|
||||
});
|
||||
});
|
||||
|
||||
// Try dragging the tab into a new window when not at the maximum number of
|
||||
// Large-Allocation processes.
|
||||
yield BrowserTestUtils.withNewTab("about:blank", function*(aBrowser) {
|
||||
info("Starting test 7");
|
||||
|
||||
let pid1 = yield getPID(aBrowser);
|
||||
is(false, yield getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser)]);
|
||||
yield ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
yield ready;
|
||||
|
||||
let pid2 = yield getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, yield getInLAProc(aBrowser));
|
||||
|
||||
let newWindow = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
|
||||
newWindow.gBrowser.adoptTab(gBrowser.getTabForBrowser(aBrowser), 0);
|
||||
let newTab = newWindow.gBrowser.tabs[0];
|
||||
|
||||
is(newTab.linkedBrowser.currentURI.spec, TEST_URI);
|
||||
is(newTab.linkedBrowser.remoteType, "webLargeAllocation");
|
||||
let pid3 = yield getPID(newTab.linkedBrowser);
|
||||
|
||||
is(pid2, pid3, "PIDs 2 and 3 should match");
|
||||
is(true, yield getInLAProc(newTab.linkedBrowser));
|
||||
|
||||
yield BrowserTestUtils.closeWindow(newWindow);
|
||||
});
|
||||
|
||||
// Try opening a new Large-Allocation document when at the max number of large
|
||||
// allocation processes.
|
||||
yield BrowserTestUtils.withNewTab("about:blank", function*(aBrowser) {
|
||||
info("Starting test 8");
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["dom.ipc.processCount.webLargeAllocation", 1]
|
||||
@ -394,7 +432,7 @@ function* largeAllocSuccessTests() {
|
||||
|
||||
// view-source tabs should not be considered to be in a large-allocation process.
|
||||
yield BrowserTestUtils.withNewTab("about:blank", function*(aBrowser) {
|
||||
info("Starting test 8");
|
||||
info("Starting test 9");
|
||||
let pid1 = yield getPID(aBrowser);
|
||||
is(false, yield getInLAProc(aBrowser));
|
||||
|
||||
@ -414,6 +452,50 @@ function* largeAllocSuccessTests() {
|
||||
|
||||
stopExpectNoProcess();
|
||||
});
|
||||
|
||||
// Try dragging tab into new window when at the max number of large allocation
|
||||
// processes.
|
||||
yield BrowserTestUtils.withNewTab("about:blank", function*(aBrowser) {
|
||||
info("Starting test 10");
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["dom.ipc.processCount.webLargeAllocation", 1]
|
||||
],
|
||||
});
|
||||
|
||||
let pid1 = yield getPID(aBrowser);
|
||||
is(false, yield getInLAProc(aBrowser));
|
||||
|
||||
let ready = Promise.all([expectProcessCreated(),
|
||||
BrowserTestUtils.browserLoaded(aBrowser)]);
|
||||
yield ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||
content.document.location = TEST_URI;
|
||||
});
|
||||
|
||||
yield ready;
|
||||
|
||||
let pid2 = yield getPID(aBrowser);
|
||||
|
||||
isnot(pid1, pid2, "PIDs 1 and 2 should not match");
|
||||
is(true, yield getInLAProc(aBrowser));
|
||||
|
||||
let newWindow = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
|
||||
newWindow.gBrowser.adoptTab(gBrowser.getTabForBrowser(aBrowser), 0);
|
||||
let newTab = newWindow.gBrowser.tabs[0];
|
||||
|
||||
is(newTab.linkedBrowser.currentURI.spec, TEST_URI);
|
||||
is(newTab.linkedBrowser.remoteType, "webLargeAllocation");
|
||||
let pid3 = yield getPID(newTab.linkedBrowser);
|
||||
|
||||
is(pid2, pid3, "PIDs 2 and 3 should match");
|
||||
is(true, yield getInLAProc(newTab.linkedBrowser));
|
||||
|
||||
yield BrowserTestUtils.closeWindow(newWindow);
|
||||
});
|
||||
|
||||
// XXX: Make sure to reset dom.ipc.processCount.webLargeAllocation if adding a
|
||||
// test after the above test.
|
||||
}
|
||||
|
||||
function* largeAllocFailTests() {
|
||||
|
Loading…
Reference in New Issue
Block a user