Bug 1399854 - Intermittent browser/components/newtab/tests/browser/browser_newtab_overrides.js leaked 2 windows until shutdown draft
authorUrsula Sarracini
Wed, 01 Nov 2017 10:11:18 -0400
changeset 690082 94ba358e499f6e702c169c689583c02182b52996
parent 690034 cd7217cf05a2332a8fd7b498767a07b2c31ea657
child 738482 59173eeec4cb4381cf7f57941e788195301f88fc
push id87204
push userusarracini@mozilla.com
push dateWed, 01 Nov 2017 14:48:44 +0000
bugs1399854
milestone58.0a1
Bug 1399854 - Intermittent browser/components/newtab/tests/browser/browser_newtab_overrides.js leaked 2 windows until shutdown MozReview-Commit-ID: e4fs23Rdmn
browser/components/newtab/tests/browser/browser.ini
browser/components/newtab/tests/browser/browser_newtab_overrides.js
browser/components/newtab/tests/browser/browser_remotenewtab_pageloads.js
browser/components/newtab/tests/browser/dummy_page.html
--- a/browser/components/newtab/tests/browser/browser.ini
+++ b/browser/components/newtab/tests/browser/browser.ini
@@ -1,7 +1,3 @@
 [DEFAULT]
-support-files =
-  dummy_page.html
 
-[browser_remotenewtab_pageloads.js]
 [browser_newtab_overrides.js]
-skip-if = true # bug 1399854
--- a/browser/components/newtab/tests/browser/browser_newtab_overrides.js
+++ b/browser/components/newtab/tests/browser/browser_newtab_overrides.js
@@ -17,17 +17,17 @@ registerCleanupFunction(function() {
 });
 
 /*
  * Tests that the default newtab page is always returned when one types "about:newtab" in the URL bar,
  * even when overridden.
  */
 add_task(async function redirector_ignores_override() {
   let overrides = [
-    "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
+    "chrome://browser/content/aboutRobots.xhtml",
     "about:home",
   ];
 
   for (let overrideURL of overrides) {
     let notificationPromise = nextChangeNotificationPromise(overrideURL, `newtab page now points to ${overrideURL}`);
     aboutNewTabService.newTabURL = overrideURL;
 
     await notificationPromise;
@@ -57,17 +57,17 @@ add_task(async function redirector_ignor
   }
 });
 
 /*
  * Tests loading an overridden newtab page by simulating opening a newtab page from chrome
  */
 add_task(async function override_loads_in_browser() {
   let overrides = [
-    "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
+    "chrome://browser/content/aboutRobots.xhtml",
     "about:home",
     " about:home",
   ];
 
   for (let overrideURL of overrides) {
     let notificationPromise = nextChangeNotificationPromise(overrideURL.trim(), `newtab page now points to ${overrideURL}`);
     aboutNewTabService.newTabURL = overrideURL;
 
deleted file mode 100644
--- a/browser/components/newtab/tests/browser/browser_remotenewtab_pageloads.js
+++ /dev/null
@@ -1,50 +0,0 @@
-"use strict";
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
-                                   "@mozilla.org/browser/aboutnewtab-service;1",
-                                   "nsIAboutNewTabService");
-
-const TEST_URL = "https://example.com/browser/browser/components/newtab/tests/browser/dummy_page.html";
-
-/*
- * Tests opening a newtab page with a remote URL. Simulates a newtab open from chrome
- */
-add_task(async function open_newtab() {
-  let notificationPromise = nextChangeNotificationPromise(TEST_URL, "newtab page now points to test url");
-  aboutNewTabService.newTabURL = TEST_URL;
-
-  await notificationPromise;
-  Assert.ok(aboutNewTabService.overridden, "url has been overridden");
-
-  /*
-   * Simulate a newtab open as a user would.
-   *
-   * Bug 1240169 - We cannot set the URL to about:newtab because that would invoke the redirector.
-   * The redirector always yields the loading of a default newtab URL. We expect the user to use
-   * the browser UI to access overriding URLs, for istance by click on the "+" button in the tab
-   * bar, or by using the new tab shortcut key.
-   */
-  BrowserOpenTab(); // jshint ignore:line
-
-  let browser = gBrowser.selectedBrowser;
-  await BrowserTestUtils.browserLoaded(browser);
-
-  await ContentTask.spawn(browser, {url: TEST_URL}, async function(args) {
-    Assert.equal(content.document.location.href, args.url,
-      "document.location should match the external resource");
-    Assert.equal(content.document.documentURI, args.url,
-      "document.documentURI should match the external resource");
-    Assert.equal(content.document.nodePrincipal.URI.spec, args.url,
-      "nodePrincipal should match the external resource");
-  });
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
-});
-
-function nextChangeNotificationPromise(aNewURL, testMessage) {
-  return TestUtils.topicObserved("newtab-url-changed", function observer(aSubject, aData) { // jshint unused:false
-      Assert.equal(aData, aNewURL, testMessage);
-      return true;
-  });
-}
deleted file mode 100644
--- a/browser/components/newtab/tests/browser/dummy_page.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
-  <meta charset="utf-8">
-</head>
-<body>
-<p>Dummy Page</p>
-</body>
-</html>