diff options
Diffstat (limited to 'mobile/android/tests/browser/chrome/test_offline_page.html')
-rw-r--r-- | mobile/android/tests/browser/chrome/test_offline_page.html | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/mobile/android/tests/browser/chrome/test_offline_page.html b/mobile/android/tests/browser/chrome/test_offline_page.html deleted file mode 100644 index e1b723266..000000000 --- a/mobile/android/tests/browser/chrome/test_offline_page.html +++ /dev/null @@ -1,111 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1089190 -Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1089190</title> - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script> - <link rel="stylesheet" type="text/css" href="chrome://global/skin"/> - <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> - <script type="application/javascript" src="head.js"></script> - <script type="application/javascript;version=1.7"> - - "use strict"; - - const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - - Cu.import("resource://gre/modules/Services.jsm"); - Cu.import("resource://gre/modules/Messaging.jsm"); - Cu.import("resource://gre/modules/Task.jsm"); - - // Provide a helper to yield until we are sure the offline state has changed - function promiseOffline(isOffline) { - return new Promise((resolve, reject) => { - function observe(subject, topic, data) { - info("Received topic: " + topic); - Services.obs.removeObserver(observe, "network:offline-status-changed"); - resolve(); - } - Services.obs.addObserver(observe, "network:offline-status-changed", false); - Services.io.offline = isOffline; - }); - } - - // The chrome window - let chromeWin; - - // Track the <browser> where the tests are happening - let browser; - - // The proxy setting - let proxyPrefValue; - - const kUniqueURI = Services.io.newURI("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_controls.html", null, null); - - add_task(function* test_offline() { - // Tests always connect to localhost, and per bug 87717, localhost is now - // reachable in offline mode. To avoid this, disable any proxy. - proxyPrefValue = Services.prefs.getIntPref("network.proxy.type"); - Services.prefs.setIntPref("network.proxy.type", 0); - - // Clear network cache. - Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService).clear(); - - chromeWin = Services.wm.getMostRecentWindow("navigator:browser"); - let BrowserApp = chromeWin.BrowserApp; - - // Add a new tab with a blank page so we can better control the real page load and the offline state - browser = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id }).browser; - - SimpleTest.registerCleanupFunction(function() { - BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser)); - Services.prefs.setIntPref("network.proxy.type", proxyPrefValue); - Services.io.offline = false; - }); - - // Go offline, expecting the error page. - yield promiseOffline(true); - - // Load our test web page - browser.loadURI(kUniqueURI.spec, null, null) - yield promiseBrowserEvent(browser, "DOMContentLoaded"); - - // This is an error page. - is(browser.contentDocument.documentURI.substring(0, 27), "about:neterror?e=netOffline", "Document URI is the error page."); - - // But location bar should show the original request. - is(browser.contentWindow.location.href, kUniqueURI.spec, "Docshell URI is the original URI."); - - Services.prefs.setIntPref("network.proxy.type", proxyPrefValue); - - // Go online and try to load the page again - yield promiseOffline(false); - - ok(browser.contentDocument.getElementById("errorTryAgain"), "The error page has got a #errorTryAgain element"); - - // Click "Try Again" button to start the page load - browser.contentDocument.getElementById("errorTryAgain").click(); - yield promiseBrowserEvent(browser, "DOMContentLoaded"); - - // This is not an error page. - is(browser.contentDocument.documentURI, kUniqueURI.spec, "Document URI is not the offline-error page, but the original URI."); - }); - - </script> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1089190">Mozilla Bug 1089190</a> -<br> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testOfflinePage</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -</pre> -</body> -</html> |