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

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

Issue 2061493002: Adds support for attaching a market referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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 87a615876182c2405fe386bd134046e63f16d0ab..3e1799e5754a0df759230e5df40754f804e084f7 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
@@ -65,6 +65,14 @@ public class ExternalNavigationHandlerTest extends InstrumentationTestCase {
"intent://scan/#Intent;scheme=zxing;"
+ "S." + ExternalNavigationHandler.EXTRA_BROWSER_FALLBACK_URL + "="
+ Uri.encode("http://url.myredirector.com/aaa") + ";end";
+ private static final String ENCODED_MARKET_REFERRER =
+ "_placement%3D{placement}%26network%3D{network}%26device%3D{devicemodel}";
+ private static final String INTENT_APP_NOT_INSTALLED_DEFAULT_MARKET_REFERRER =
+ "intent:///name/nm0000158#Intent;scheme=imdb;package=com.imdb.mobile;end";
+ private static final String INTENT_APP_NOT_INSTALLED_WITH_MARKET_REFERRER =
+ "intent:///name/nm0000158#Intent;scheme=imdb;package=com.imdb.mobile;S."
+ + ExternalNavigationHandler.EXTRA_MARKET_REFERRER + "="
+ + ENCODED_MARKET_REFERRER + ";end";
private static final String PLUS_STREAM_URL = "https://plus.google.com/stream";
private static final String CALENDAR_URL = "http://www.google.com/calendar";
@@ -229,6 +237,35 @@ public class ExternalNavigationHandlerTest extends InstrumentationTestCase {
}
@SmallTest
+ public void testRedirectToMarketWithReferrer() {
+ mDelegate.setCanResolveActivity(false);
+
+ checkUrl(INTENT_APP_NOT_INSTALLED_WITH_MARKET_REFERRER)
+ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT,
+ START_OTHER_ACTIVITY);
+
+ assertNotNull(mDelegate.startActivityIntent);
+ Uri uri = mDelegate.startActivityIntent.getData();
+ assertEquals("market", uri.getScheme());
+ assertEquals(Uri.decode(ENCODED_MARKET_REFERRER), uri.getQueryParameter("referrer"));
+ }
+
+
+ @SmallTest
+ public void testRedirectToMarketWithoutReferrer() {
+ mDelegate.setCanResolveActivity(false);
+
+ checkUrl(INTENT_APP_NOT_INSTALLED_DEFAULT_MARKET_REFERRER)
+ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT,
+ START_OTHER_ACTIVITY);
+
+ assertNotNull(mDelegate.startActivityIntent);
+ Uri uri = mDelegate.startActivityIntent.getData();
+ assertEquals("market", uri.getScheme());
+ assertEquals(mDelegate.getPackageName(), uri.getQueryParameter("referrer"));
+ }
+
+ @SmallTest
public void testExternalUri() {
checkUrl("tel:012345678")
.expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT,

Powered by Google App Engine
This is Rietveld 408576698