| OLD | NEW |
| 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.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.pm.ActivityInfo; | 10 import android.content.pm.ActivityInfo; |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 boolean expectStartActivity = (otherExpectation & START_ACTIVITY) != 0; | 1041 boolean expectStartActivity = (otherExpectation & START_ACTIVITY) != 0; |
| 1042 boolean expectSaneIntent = (otherExpectation & INTENT_SANITIZATION_EXCEP
TION) == 0; | 1042 boolean expectSaneIntent = (otherExpectation & INTENT_SANITIZATION_EXCEP
TION) == 0; |
| 1043 | 1043 |
| 1044 mDelegate.reset(); | 1044 mDelegate.reset(); |
| 1045 | 1045 |
| 1046 ExternalNavigationParams params = new ExternalNavigationParams.Builder(u
rl, isIncognito, | 1046 ExternalNavigationParams params = new ExternalNavigationParams.Builder(u
rl, isIncognito, |
| 1047 referrerUrl, pageTransition, isRedirect == REDIRECT) | 1047 referrerUrl, pageTransition, isRedirect == REDIRECT) |
| 1048 .setApplicationMustBeInForeground(chromeAppInForegroundRequired) | 1048 .setApplicationMustBeInForeground(chromeAppInForegroundRequired) |
| 1049 .setRedirectHandler(redirectHandler) | 1049 .setRedirectHandler(redirectHandler) |
| 1050 .setIsBackgroundTabNavigation(isBackgroundTabNavigation) | 1050 .setIsBackgroundTabNavigation(isBackgroundTabNavigation) |
| 1051 .setIsMainFrame(true) |
| 1051 .build(); | 1052 .build(); |
| 1052 OverrideUrlLoadingResult result = mUrlHandler.shouldOverrideUrlLoading(p
arams); | 1053 OverrideUrlLoadingResult result = mUrlHandler.shouldOverrideUrlLoading(p
arams); |
| 1053 boolean startActivityCalled = mDelegate.startActivityIntent != null; | 1054 boolean startActivityCalled = mDelegate.startActivityIntent != null; |
| 1054 | 1055 |
| 1055 assertEquals(expectedOverrideResult, result); | 1056 assertEquals(expectedOverrideResult, result); |
| 1056 assertEquals(expectStartIncognito, mDelegate.startIncognitoIntentCalled)
; | 1057 assertEquals(expectStartIncognito, mDelegate.startIncognitoIntentCalled)
; |
| 1057 assertEquals(expectStartActivity, startActivityCalled); | 1058 assertEquals(expectStartActivity, startActivityCalled); |
| 1058 | 1059 |
| 1059 if (startActivityCalled && expectSaneIntent) { | 1060 if (startActivityCalled && expectSaneIntent) { |
| 1060 checkIntentSanity(mDelegate.startActivityIntent, "Intent"); | 1061 checkIntentSanity(mDelegate.startActivityIntent, "Intent"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 return new TestPackageManager(); | 1094 return new TestPackageManager(); |
| 1094 } | 1095 } |
| 1095 | 1096 |
| 1096 @Override | 1097 @Override |
| 1097 public String getPackageName() { | 1098 public String getPackageName() { |
| 1098 return "test.app.name"; | 1099 return "test.app.name"; |
| 1099 } | 1100 } |
| 1100 | 1101 |
| 1101 } | 1102 } |
| 1102 } | 1103 } |
| OLD | NEW |