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

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

Issue 2593093002: Instant Apps: Add instrumentation tests. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
index 93a82f77a0c2d492e6190c9d974ce23abfce3855..07d89145a1469c243da13dcca9053c12e9c826a8 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
@@ -21,6 +21,7 @@ import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.OverrideUrlLoadingResult;
+import org.chromium.chrome.browser.instantapps.InstantAppsHandler;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabRedirectHandler;
import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
@@ -45,6 +46,7 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
private static final int START_FILE = 0x8;
private static final int START_OTHER_ACTIVITY = 0x10;
private static final int INTENT_SANITIZATION_EXCEPTION = 0x20;
+ private static final int PROXY_FOR_INSTANT_APPS = 0x40;
private static final String SEARCH_RESULT_URL_FOR_TOM_HANKS =
"https://www.google.com/search?q=tom+hanks";
@@ -1241,6 +1243,7 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
// For simplicity, don't distinguish between startActivityIfNeeded and startActivity
// until a test requires this distinction.
startActivityIntent = intent;
+ mCalledWithProxy = proxy;
return true;
}
@@ -1299,14 +1302,15 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
}
@Override
- public boolean isSerpReferrer(String referrerUrl, Tab tab) {
- return false;
+ public boolean isSerpReferrer(Tab tab) {
+ return mIsSerpReferrer;
}
public void reset() {
startActivityIntent = null;
startIncognitoIntentCalled = false;
startFileIntentCalled = false;
+ mCalledWithProxy = false;
}
public void setCanResolveActivity(boolean value) {
@@ -1333,8 +1337,12 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
mCanHandleWithInstantApp = value;
}
- public Intent startActivityIntent = null;
- public boolean startIncognitoIntentCalled = false;
+ public void setIsSerpReferrer(boolean value) {
+ mIsSerpReferrer = value;
+ }
+
+ public Intent startActivityIntent;
+ public boolean startIncognitoIntentCalled;
// This should not be reset for every run of check().
private Boolean mQueryIntentOverride;
@@ -1342,6 +1350,8 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
private String mNewUrlAfterClobbering;
private String mReferrerUrlForClobbering;
private boolean mCanHandleWithInstantApp;
+ private boolean mIsSerpReferrer;
+ public boolean mCalledWithProxy;
public boolean mIsChromeAppInForeground = true;
public boolean mIsWithinCurrentWebappScope;
@@ -1431,6 +1441,7 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
boolean expectStartFile = (otherExpectation & START_FILE) != 0;
boolean expectSaneIntent = expectStartOtherActivity
&& (otherExpectation & INTENT_SANITIZATION_EXCEPTION) == 0;
+ boolean expectProxyForIA = (otherExpectation & PROXY_FOR_INSTANT_APPS) != 0;
mDelegate.reset();
@@ -1464,6 +1475,7 @@ public class ExternalNavigationHandlerTest extends NativeLibraryTestBase {
assertEquals(expectStartChrome, startChromeCalled);
assertEquals(expectStartWebApk, startWebApkCalled);
assertEquals(expectStartFile, mDelegate.startFileIntentCalled);
+ assertEquals(expectProxyForIA, mDelegate.mCalledWithProxy);
if (startActivityCalled && expectSaneIntent) {
checkIntentSanity(mDelegate.startActivityIntent, "Intent");
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698