Bug 1487834 - Test fallback URL support for Intent URIs. r=esawin
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 03 Sep 2018 23:10:47 +0000
changeset 482876 ecdd813a74a4aa165bf4c86c4ed321f54becce7a
parent 482875 24758013085af278b8f05b224477e1afcc08eb3e
child 482877 f8fe981dd967ac0435af743aff48b9743df719ad
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersesawin
bugs1487834
milestone63.0a1
Bug 1487834 - Test fallback URL support for Intent URIs. r=esawin Differential Revision: https://phabricator.services.mozilla.com/D4781
mobile/android/tests/browser/robocop/robocop.ini
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/helpers/NavigationHelper.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testIntentUri.java
--- a/mobile/android/tests/browser/robocop/robocop.ini
+++ b/mobile/android/tests/browser/robocop/robocop.ini
@@ -45,16 +45,17 @@ skip-if = true # Bug 1390059
 [src/org/mozilla/gecko/tests/testGetUserMedia.java]
 # failures across the board, bug 1092202 & bug 1144926
 skip-if = true
 [src/org/mozilla/gecko/tests/testHistory.java]
 disabled=see bug 915350
 [src/org/mozilla/gecko/tests/testHomeBanner.java]
 [src/org/mozilla/gecko/tests/testIdnSupport.java]
 [src/org/mozilla/gecko/tests/testInputUrlBar.java]
+[src/org/mozilla/gecko/tests/testIntentUri.java]
 [src/org/mozilla/gecko/tests/testJarReader.java]
 [src/org/mozilla/gecko/tests/testLinkContextMenu.java]
 [src/org/mozilla/gecko/tests/testHomeListsProvider.java]
 disabled=see bug 952310
 [src/org/mozilla/gecko/tests/testLoad.java]
 skip-if = true # Bug 1390059
 [src/org/mozilla/gecko/tests/testMailToContextMenu.java]
 [src/org/mozilla/gecko/tests/testNewTab.java]
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/helpers/NavigationHelper.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/helpers/NavigationHelper.java
@@ -43,17 +43,17 @@ final public class NavigationHelper {
 
     /**
      * Returns a new URL with the docshell HTTP server host prefix.
      */
     public static String adjustUrl(final String url) {
         fAssertNotNull("url is not null", url);
 
         if (url.startsWith("about:") || url.startsWith("chrome:") ||
-                url.startsWith("view-source:")) {
+                url.startsWith("intent:") || url.startsWith("view-source:")) {
             return url;
         }
 
         return sContext.getAbsoluteHostnameUrl(url);
     }
 
     public static void goBack() {
         if (DeviceHelper.isTablet()) {
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testIntentUri.java
@@ -0,0 +1,26 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+ * vim: ts=4 sw=4 expandtab:
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+package org.mozilla.gecko.tests;
+
+import org.mozilla.gecko.tests.helpers.GeckoHelper;
+import org.mozilla.gecko.tests.helpers.NavigationHelper;
+
+import java.net.URLEncoder;
+
+public class testIntentUri extends UITest {
+    public void testIntentUrlFallback() {
+        final String targetPage = getAbsoluteHostnameUrl(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
+        final String encodedTargetPage = URLEncoder.encode(targetPage);
+        final String intentUri = "intent://this.url/wont/be/loaded" +
+                "#Intent;scheme=https;package=org.mozilla.notinstalled;" +
+                "S.browser_fallback_url=" + encodedTargetPage + ";end";
+
+        GeckoHelper.blockForReady();
+
+        NavigationHelper.enterAndLoadUrl(intentUri);
+        mToolbar.assertTitle(targetPage);
+    }
+}