Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java

Issue 2727483002: Instant Apps: refactor logic to encapsulate in the Instant Apps Handler. (Closed)
Patch Set: Fix findbugs issue. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.externalnav; 5 package org.chromium.chrome.browser.externalnav;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.content.pm.ActivityInfo; 9 import android.content.pm.ActivityInfo;
10 import android.content.pm.PackageManager; 10 import android.content.pm.PackageManager;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 private static final String WEBAPK_WITH_NATIVE_APP_SCOPE = 92 private static final String WEBAPK_WITH_NATIVE_APP_SCOPE =
93 "https://www.webapk.with.native.com"; 93 "https://www.webapk.with.native.com";
94 private static final String WEBAPK_WITH_NATIVE_APP_PACKAGE_NAME = 94 private static final String WEBAPK_WITH_NATIVE_APP_PACKAGE_NAME =
95 "org.chromium.webapk.with.native"; 95 "org.chromium.webapk.with.native";
96 private static final String NATIVE_APP_PACKAGE_NAME = "com.webapk.with.nativ e.android"; 96 private static final String NATIVE_APP_PACKAGE_NAME = "com.webapk.with.nativ e.android";
97 97
98 private static final String COUNTERFEIT_WEBAPK_SCOPE = "http://www.counterfe it.webapk.com"; 98 private static final String COUNTERFEIT_WEBAPK_SCOPE = "http://www.counterfe it.webapk.com";
99 private static final String COUNTERFEIT_WEBAPK_PACKAGE_NAME = 99 private static final String COUNTERFEIT_WEBAPK_PACKAGE_NAME =
100 "org.chromium.webapk.counterfeit"; 100 "org.chromium.webapk.counterfeit";
101 101
102 private static final String[] SUPERVISOR_START_ACTIONS = {
Ted C 2017/03/01 16:55:51 I've vote to make the other ones public and marked
Maria 2017/03/01 17:43:39 That's what I did in patch 1. Turns out it's a fin
103 "com.google.android.instantapps.START", "com.google.android.instanta pps.nmr1.INSTALL",
104 "com.google.android.instantapps.nmr1.VIEW"};
105
102 private final TestExternalNavigationDelegate mDelegate; 106 private final TestExternalNavigationDelegate mDelegate;
103 private ExternalNavigationHandler mUrlHandler; 107 private ExternalNavigationHandler mUrlHandler;
104 108
105 public ExternalNavigationHandlerTest() { 109 public ExternalNavigationHandlerTest() {
106 mDelegate = new TestExternalNavigationDelegate(); 110 mDelegate = new TestExternalNavigationDelegate();
107 mUrlHandler = new ExternalNavigationHandler(mDelegate); 111 mUrlHandler = new ExternalNavigationHandler(mDelegate);
108 } 112 }
109 113
110 @Override 114 @Override
111 protected void setUp() throws Exception { 115 protected void setUp() throws Exception {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 + "S.com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRE R=" 620 + "S.com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRE R="
617 + "true;S.android.intent.extra.REFERRER_NAME=" 621 + "true;S.android.intent.extra.REFERRER_NAME="
618 + "https%3A%2F%2Fwww.google.com;end"; 622 + "https%3A%2F%2Fwww.google.com;end";
619 checkUrl(nonSupervisor) 623 checkUrl(nonSupervisor)
620 .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN T, 624 .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN T,
621 START_OTHER_ACTIVITY); 625 START_OTHER_ACTIVITY);
622 assertFalse(mDelegate.startActivityIntent.hasExtra( 626 assertFalse(mDelegate.startActivityIntent.hasExtra(
623 InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER)); 627 InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER));
624 628
625 // Check that Supervisor is detected by action even without package 629 // Check that Supervisor is detected by action even without package
626 for (String action : ExternalNavigationHandler.SUPERVISOR_START_ACTIONS) { 630 for (String action : SUPERVISOR_START_ACTIONS) {
627 String intentWithoutPackage = "intent://buzzfeed.com/tasty#Intent;sc heme=http;" 631 String intentWithoutPackage = "intent://buzzfeed.com/tasty#Intent;sc heme=http;"
628 + "action=" + action + ";" 632 + "action=" + action + ";"
629 + "S.com.google.android.instantapps.FALLBACK_PACKAGE=" 633 + "S.com.google.android.instantapps.FALLBACK_PACKAGE="
630 + "com.android.chrome;S.com.google.android.instantapps.INSTA NT_APP_PACKAGE=" 634 + "com.android.chrome;S.com.google.android.instantapps.INSTA NT_APP_PACKAGE="
631 + "com.yelp.android;S.android.intent.extra.REFERRER_NAME=" 635 + "com.yelp.android;S.android.intent.extra.REFERRER_NAME="
632 + "https%3A%2F%2Fwww.google.com;end"; 636 + "https%3A%2F%2Fwww.google.com;end";
633 mDelegate.setIsSerpReferrer(false); 637 mDelegate.setIsSerpReferrer(false);
634 checkUrl(intentWithoutPackage) 638 checkUrl(intentWithoutPackage)
635 .expecting(OverrideUrlLoadingResult.NO_OVERRIDE, IGNORE); 639 .expecting(OverrideUrlLoadingResult.NO_OVERRIDE, IGNORE);
636 } 640 }
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 return new TestPackageManager(); 1574 return new TestPackageManager();
1571 } 1575 }
1572 1576
1573 @Override 1577 @Override
1574 public String getPackageName() { 1578 public String getPackageName() {
1575 return "test.app.name"; 1579 return "test.app.name";
1576 } 1580 }
1577 1581
1578 } 1582 }
1579 } 1583 }
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698