Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java |
| index 3b41bb1bcc0772e62c038f4a3374cd21edb77d96..bb938911eff4896780d4505a1d2cd0904485cddf 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java |
| @@ -4,18 +4,26 @@ |
| package org.chromium.chrome.browser.webapps; |
| +import android.content.Intent; |
| import android.test.suitebuilder.annotation.MediumTest; |
| import org.chromium.base.test.util.Feature; |
| import org.chromium.chrome.browser.ShortcutHelper; |
| -import org.chromium.chrome.browser.ShortcutSource; |
| import org.chromium.components.security_state.ConnectionSecurityLevel; |
| -import org.chromium.content_public.common.ScreenOrientationValues; |
| /** |
| * Tests the logic in top controls visibility delegate in WebappActivity. |
| */ |
| public class WebappVisibilityTest extends WebappActivityTestBase { |
| + private static final String WEBAPP_URL = "http://originalwebsite.com"; |
| + |
| + @Override |
| + protected Intent createIntent() { |
|
pkotwicz
2016/05/18 23:00:18
Sorry I should have given you a link to the CL. Th
Xi Han
2016/05/19 18:31:50
That is ok, I follow that CL so the changes are co
|
| + Intent intent = super.createIntent(); |
| + intent.putExtra(ShortcutHelper.EXTRA_URL, WEBAPP_URL); |
| + return intent; |
| + } |
| + |
| @Override |
| protected void setUp() throws Exception { |
| super.setUp(); |
| @@ -25,12 +33,6 @@ public class WebappVisibilityTest extends WebappActivityTestBase { |
| @MediumTest |
| @Feature({"Webapps"}) |
| public void testShouldShowTopControls() { |
| - final String webappUrl = "http://originalwebsite.com"; |
| - WebappInfo mockInfo = WebappInfo.create(WEBAPP_ID, webappUrl, null, |
| - null, null, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN, |
| - ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, |
| - ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); |
| - getActivity().getWebappInfo().copy(mockInfo); |
| // Show top controls for out-of-domain URLs. |
| assertTrue(getActivity().shouldShowTopControls( |
| @@ -43,11 +45,11 @@ public class WebappVisibilityTest extends WebappActivityTestBase { |
| "http://sub.originalwebsite.com", ConnectionSecurityLevel.NONE)); |
| assertFalse(getActivity().shouldShowTopControls( |
| "http://thing.originalwebsite.com", ConnectionSecurityLevel.NONE)); |
| - assertFalse(getActivity().shouldShowTopControls(webappUrl, ConnectionSecurityLevel.NONE)); |
| + assertFalse(getActivity().shouldShowTopControls(WEBAPP_URL, ConnectionSecurityLevel.NONE)); |
| assertFalse(getActivity().shouldShowTopControls( |
| - webappUrl + "/things.html", ConnectionSecurityLevel.NONE)); |
| + WEBAPP_URL + "/things.html", ConnectionSecurityLevel.NONE)); |
| assertFalse(getActivity().shouldShowTopControls( |
| - webappUrl + "/stuff.html", ConnectionSecurityLevel.NONE)); |
| + WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.NONE)); |
| // Do not show top controls when URL is not available yet. |
| assertFalse(getActivity().shouldShowTopControls("", ConnectionSecurityLevel.NONE)); |
| @@ -62,10 +64,10 @@ public class WebappVisibilityTest extends WebappActivityTestBase { |
| assertTrue(getActivity().shouldShowTopControls( |
| "http://thing.originalwebsite.com", ConnectionSecurityLevel.SECURITY_ERROR)); |
| assertTrue(getActivity().shouldShowTopControls( |
| - webappUrl, ConnectionSecurityLevel.SECURITY_WARNING)); |
| + WEBAPP_URL, ConnectionSecurityLevel.SECURITY_WARNING)); |
| assertTrue(getActivity().shouldShowTopControls( |
| - webappUrl + "/things.html", ConnectionSecurityLevel.SECURITY_WARNING)); |
| + WEBAPP_URL + "/things.html", ConnectionSecurityLevel.SECURITY_WARNING)); |
| assertTrue(getActivity().shouldShowTopControls( |
| - webappUrl + "/stuff.html", ConnectionSecurityLevel.SECURITY_WARNING)); |
| + WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.SECURITY_WARNING)); |
| } |
| } |