Commit b2d679e2 authored by Maria Khomenko's avatar Maria Khomenko Committed by Commit Bot

Revert "[Android] Cleanup ExternalNavigationHandlerTest"

This reverts commit e4c53ce3.

Reason for revert: Breaks Marshmallow Tester bot:
https://uberchromegw.corp.google.com/i/chromium.android/builders/Marshmallow%2064%20bit%20Tester/builds/19160

Original change's description:
> [Android] Cleanup ExternalNavigationHandlerTest
> 
> This CL:
> - Replaces calls to
>   ExternalNavigationDelegateImpl#isSpecializedHandlerAvailable() with calls to
>   #countSpecializedHandlers() because #isSpecializedHandlerAvailable() has just
>   one caller
> - Replaces ChromeBrowserTestRule with NativeLibraryTestRule
> - Uses a mock context for both ContextUtils#getApplicationContext() and for
>   TabRedirectHandler instead of just for TabRedirectHandler
> - Makes TestPackageManager#queryIntentActivities() and
>   TestExternalNavigationDelegate#queryIntentActivities() use same
>   implementation.
> - Changes tests to register relevant http:// and https:// handlers at the
>   beginning of the test. This is a change of behavior. Previously, most URLs
>   would be handled by the "foo" external app
> - Changes TestExternalNavigationDelegate#mQueryIntentOverride from tristate to
>   boolean. The "true behavior" was nuked but the "false behavior" was
>   preserved.
> 
> BUG=None
> 
> Change-Id: If212afde6e4c12d4f08576c4bd26392b8732bc09
> Reviewed-on: https://chromium-review.googlesource.com/891744
> Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
> Reviewed-by: Maria Khomenko <mariakhomenko@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#532970}

TBR=mariakhomenko@chromium.org,pkotwicz@chromium.org,thildebr@chromium.org

Change-Id: Ifb044a014ac4d94a74fffaf493cc3aad32b42ad5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/894684Reviewed-by: default avatarMaria Khomenko <mariakhomenko@chromium.org>
Commit-Queue: Maria Khomenko <mariakhomenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533123}
parent 34cf9de7
...@@ -29,6 +29,12 @@ interface ExternalNavigationDelegate { ...@@ -29,6 +29,12 @@ interface ExternalNavigationDelegate {
*/ */
boolean willChromeHandleIntent(Intent intent); boolean willChromeHandleIntent(Intent intent);
/**
* Search for intent handlers that are specific to this URL aka, specialized apps like
* google maps or youtube
*/
boolean isSpecializedHandlerAvailable(List<ResolveInfo> infos);
/** /**
* Returns true if the current activity is a webapp and {@params url} lies within the scope of * Returns true if the current activity is a webapp and {@params url} lies within the scope of
* that webapp. * that webapp.
......
...@@ -253,6 +253,11 @@ public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat ...@@ -253,6 +253,11 @@ public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat
return willChromeHandleIntent(intent, false); return willChromeHandleIntent(intent, false);
} }
@Override
public boolean isSpecializedHandlerAvailable(List<ResolveInfo> infos) {
return countSpecializedHandlers(infos) > 0;
}
@Override @Override
public boolean isWithinCurrentWebappScope(String url) { public boolean isWithinCurrentWebappScope(String url) {
Context context = getAvailableContext(); Context context = getAvailableContext();
......
...@@ -419,7 +419,7 @@ public class ExternalNavigationHandler { ...@@ -419,7 +419,7 @@ public class ExternalNavigationHandler {
// handlers. If webkit can't handle it internally, we need to call // handlers. If webkit can't handle it internally, we need to call
// startActivityIfNeeded or startActivity. // startActivityIfNeeded or startActivity.
if (!isExternalProtocol) { if (!isExternalProtocol) {
if (mDelegate.countSpecializedHandlers(resolvingInfos) == 0) { if (!mDelegate.isSpecializedHandlerAvailable(resolvingInfos)) {
if (incomingIntentRedirect && mDelegate.maybeLaunchInstantApp( if (incomingIntentRedirect && mDelegate.maybeLaunchInstantApp(
params.getTab(), params.getUrl(), params.getReferrerUrl(), true)) { params.getTab(), params.getUrl(), params.getReferrerUrl(), true)) {
if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_EXTERNAL_INTENT: Instant Apps redirect"); if (DEBUG) Log.i(TAG, "OVERRIDE_WITH_EXTERNAL_INTENT: Instant Apps redirect");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment