Bug 1549732 - Add tests for referrer. r=geckoview-reviewers,esawin
authorEmily Toop <etoop@mozilla.com>
Mon, 13 May 2019 12:15:35 +0000
changeset 532418 85c3b0c31659658d731f96e974183d28bcdec9db
parent 532417 f9170a14e63672ffff429d81c76ffd5c49f9936f
child 532419 332a8ffe625f851dfa3014c3d52e945790984804
push id11268
push usercsabou@mozilla.com
push dateTue, 14 May 2019 15:24:22 +0000
treeherdermozilla-beta@5fb7fcd568d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, esawin
bugs1549732
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1549732 - Add tests for referrer. r=geckoview-reviewers,esawin Differential Revision: https://phabricator.services.mozilla.com/D30525
mobile/android/tests/browser/chrome/chrome.ini
mobile/android/tests/browser/chrome/test_referrer.html
--- a/mobile/android/tests/browser/chrome/chrome.ini
+++ b/mobile/android/tests/browser/chrome/chrome.ini
@@ -39,16 +39,17 @@ skip-if = debug
 [test_identity_mode.html]
 [test_media_playback.html]
 [test_migrate_ui.html]
 [test_mozAutoplayMediaBlocked.html]
 [test_network_manager.html]
 [test_offline_page.html]
 skip-if = true # Bug 1241478
 [test_reader_view.html]
+[test_referrer.html]
 [test_resource_substitutions.html]
 [test_restricted_profiles.html]
 [test_select_disabled.html]
 [test_selectoraddtab.html]
 [test_session_clear_history.html]
 [test_session_form_data.html]
 [test_session_parentid.html]
 [test_session_scroll_position.html]
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/chrome/test_referrer.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1549732
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1549732</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.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">
+
+  "use strict";
+
+  const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+  ChromeUtils.import("resource://gre/modules/Messaging.jsm");
+
+  // The chrome window
+  let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
+  let BrowserApp = chromeWin.BrowserApp;
+
+  // Track the tabs where the tests are happening
+  let tabTest;
+
+  function cleanupTabs() {
+    if (tabTest) {
+      BrowserApp.closeTab(tabTest);
+      tabTest = null;
+    }
+  }
+
+  SimpleTest.registerCleanupFunction(function() {
+    cleanupTabs();
+  });
+
+  const kTestPage = "https://example.com";
+  const kReferrer = "https://foo.org/";
+
+  add_task(async function test_referrer() {
+    tabTest = BrowserApp.addTab(kTestPage, { referrerURI: kReferrer,
+                                              parentId: BrowserApp.selectedTab.id,
+                                              selected: true});
+    await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
+
+    // Check that basic_article is now selected
+    is(BrowserApp.selectedBrowser, tabTest.browser, "Target tab is selected after being added.");
+    is(tabTest.browser.contentDocument.referrer, kReferrer, "Target tab has correct referrer");
+
+    cleanupTabs();
+  });
+
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1549732">Mozilla Bug 1549732</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>