Bug 1397365: Part 10 - Define expected start pages for new windows in telemetry and sessionrestore tests. r?mconley
One of the SessionRestore tests rely on the about:blank being the first document.
One of the telemetry tests verifies that no unidentified urls have been loaded,
so we need to open documents without urls now.
MozReview-Commit-ID: CB8XXP9omkS
--- a/browser/components/sessionstore/test/browser_async_window_flushing.js
+++ b/browser/components/sessionstore/test/browser_async_window_flushing.js
@@ -20,17 +20,17 @@ add_task(async function test_add_interes
// Make sure we can actually store another closed window
await pushPrefs(["browser.sessionstore.max_windows_undo",
initialClosedWindows + 1]);
// Create a new browser window. Since the default window will start
// at about:blank, SessionStore should find this tab (and therefore the
// whole window) uninteresting, and should not initially put it into
// the closed windows array.
- let newWin = await BrowserTestUtils.openNewBrowserWindow();
+ let newWin = await BrowserTestUtils.openNewBrowserWindow({}, "about:blank");
let browser = newWin.gBrowser.selectedBrowser;
// Send a message that will cause the content to change its location
// to someplace more interesting. We've disabled auto updates from
// the browser, so the parent won't know about this
await ContentTask.spawn(browser, PAGE, async function(newPage) {
content.location = newPage;
@@ -84,17 +84,17 @@ add_task(async function test_remove_unin
// windows stored. We'll use its length to determine whether or not
// the window was added or not.
let initialClosedWindows = ss.getClosedWindowCount();
// Make sure we can actually store another closed window
await pushPrefs(["browser.sessionstore.max_windows_undo",
initialClosedWindows + 1]);
- let newWin = await BrowserTestUtils.openNewBrowserWindow();
+ let newWin = await BrowserTestUtils.openNewBrowserWindow({}, "about:blank");
// Now browse the initial tab of that window to an interesting
// site.
let tab = newWin.gBrowser.selectedTab;
let browser = tab.linkedBrowser;
browser.loadURI(PAGE);
await BrowserTestUtils.browserLoaded(browser, false, PAGE);
@@ -146,17 +146,17 @@ add_task(async function test_synchronous
// windows stored. We'll use its length to determine whether or not
// the window was added or not.
let state = JSON.parse(ss.getBrowserState());
ok(state, "Make sure we can get the state");
let initialWindows = state.windows.length;
// Open a new window and send the first tab somewhere
// interesting.
- let newWin = await BrowserTestUtils.openNewBrowserWindow();
+ let newWin = await BrowserTestUtils.openNewBrowserWindow({}, "about:blank");
let browser = newWin.gBrowser.selectedBrowser;
browser.loadURI(PAGE);
await BrowserTestUtils.browserLoaded(browser, false, PAGE);
await TabStateFlusher.flush(browser);
state = JSON.parse(ss.getBrowserState());
is(state.windows.length, initialWindows + 1,
"The new window to be in the state");
--- a/browser/modules/test/browser/browser_UsageTelemetry.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry.js
@@ -111,17 +111,17 @@ add_task(async function test_tabsAndWind
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank"));
expectedTabOpenCount += 2;
expectedMaxTabs += 2;
checkScalars({maxTabs: expectedMaxTabs, tabOpenCount: expectedTabOpenCount, maxWindows: expectedMaxWins,
windowsOpenCount: expectedWinOpenCount, totalURIs: 0, domainCount: 0,
totalUnfilteredURIs: 0});
// Add a new window and then some tabs in it. An empty new windows counts as a tab.
- let win = await BrowserTestUtils.openNewBrowserWindow();
+ let win = await BrowserTestUtils.openNewBrowserWindow({}, "");
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:blank"));
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:blank"));
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank"));
// The new window started with a new tab, so account for it.
expectedTabOpenCount += 4;
expectedWinOpenCount += 1;
expectedMaxWins = 2;
expectedMaxTabs += 4;
@@ -144,17 +144,17 @@ add_task(async function test_tabsAndWind
totalUnfilteredURIs: 0});
});
add_task(async function test_subsessionSplit() {
// Let's reset the counts.
Services.telemetry.clearScalars();
// Add a new window (that will have 4 tabs).
- let win = await BrowserTestUtils.openNewBrowserWindow();
+ let win = await BrowserTestUtils.openNewBrowserWindow({}, "");
let openedTabs = [];
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:blank"));
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:mozilla"));
openedTabs.push(await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "http://www.example.com"));
// Check that the scalars have the right values. We expect 2 unfiltered URI loads
// (about:mozilla and www.example.com, but no about:blank) and 1 URI totalURIs
// (only www.example.com).
@@ -209,17 +209,17 @@ add_task(async function test_URIAndDomai
// Activating a different tab must not increase the URI count.
let secondTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
await BrowserTestUtils.switchTab(gBrowser, firstTab);
checkCounts({totalURIs: 1, domainCount: 1, totalUnfilteredURIs: 1});
await BrowserTestUtils.removeTab(secondTab);
// Open a new window and set the tab to a new address.
- let newWin = await BrowserTestUtils.openNewBrowserWindow();
+ let newWin = await BrowserTestUtils.openNewBrowserWindow({}, "");
await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(newWin.gBrowser.selectedBrowser);
checkCounts({totalURIs: 2, domainCount: 1, totalUnfilteredURIs: 2});
// We should not count AJAX requests.
const XHR_URL = "http://example.com/r";
await ContentTask.spawn(newWin.gBrowser.selectedBrowser, XHR_URL, function(url) {
return new Promise(resolve => {