| 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..f33f1d96ded35fc6472fa4388a9e5c25fa76f41f 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() {
|
| + Intent intent = super.createIntent();
|
| + intent.putExtra(ShortcutHelper.EXTRA_URL, WEBAPP_URL);
|
| + return intent;
|
| + }
|
| +
|
| @Override
|
| protected void setUp() throws Exception {
|
| super.setUp();
|
| @@ -25,13 +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(
|
| "http://notoriginalwebsite.com", ConnectionSecurityLevel.NONE));
|
| @@ -43,11 +44,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 +63,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));
|
| }
|
| }
|
|
|