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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java

Issue 2018113002: Upstream: Do not show the add-to-homescreen/install-native-app infobar for WebAPKs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b64925cc4adc8d9a0afd29ded9040f7802d2b391..b0b704230bfdf7db39b81d8ff2d35250337d0432 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,71 +4,70 @@
package org.chromium.chrome.browser.webapps;
-import android.content.Intent;
import android.test.suitebuilder.annotation.MediumTest;
-import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.components.security_state.ConnectionSecurityLevel;
+import org.chromium.content.browser.test.NativeLibraryTestBase;
/**
- * Tests the logic in top controls visibility delegate in WebappActivity.
+ * Tests for {@link WebappDelegateFactory}.
*/
-public class WebappVisibilityTest extends WebappActivityTestBase {
+public class WebappVisibilityTest extends NativeLibraryTestBase {
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();
- startWebappActivity();
+ loadNativeLibraryNoBrowserProcess();
}
@MediumTest
@Feature({"Webapps"})
- @DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/614336")
public void testShouldShowTopControls() {
// Show top controls for out-of-domain URLs.
- assertTrue(getActivity().shouldShowTopControls(
- "http://notoriginalwebsite.com", ConnectionSecurityLevel.NONE));
- assertTrue(getActivity().shouldShowTopControls(
- "http://otherwebsite.com", ConnectionSecurityLevel.NONE));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, "http://notoriginalwebsite.com", ConnectionSecurityLevel.NONE));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, "http://otherwebsite.com", ConnectionSecurityLevel.NONE));
// Do not show top controls for subdomains and private registries that are secure.
- assertFalse(getActivity().shouldShowTopControls(
- "http://sub.originalwebsite.com", ConnectionSecurityLevel.NONE));
- assertFalse(getActivity().shouldShowTopControls(
- "http://thing.originalwebsite.com", ConnectionSecurityLevel.NONE));
- assertFalse(getActivity().shouldShowTopControls(WEBAPP_URL, ConnectionSecurityLevel.NONE));
- assertFalse(getActivity().shouldShowTopControls(
- WEBAPP_URL + "/things.html", ConnectionSecurityLevel.NONE));
- assertFalse(getActivity().shouldShowTopControls(
- WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(
+ WEBAPP_URL, "http://sub.originalwebsite.com", ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(
+ WEBAPP_URL, "http://thing.originalwebsite.com", ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(WEBAPP_URL, WEBAPP_URL, ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(
+ WEBAPP_URL, WEBAPP_URL + "/things.html", ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(
+ WEBAPP_URL, WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.NONE));
// Do not show top controls when URL is not available yet.
- assertFalse(getActivity().shouldShowTopControls("", ConnectionSecurityLevel.NONE));
+ assertFalse(shouldShowTopControls(WEBAPP_URL, "", ConnectionSecurityLevel.NONE));
// Show top controls for non secure URLs.
- assertTrue(getActivity().shouldShowTopControls(
- "http://sub.originalwebsite.com", ConnectionSecurityLevel.SECURITY_WARNING));
- assertTrue(getActivity().shouldShowTopControls(
- "http://notoriginalwebsite.com", ConnectionSecurityLevel.SECURITY_ERROR));
- assertTrue(getActivity().shouldShowTopControls(
- "http://otherwebsite.com", ConnectionSecurityLevel.SECURITY_ERROR));
- assertTrue(getActivity().shouldShowTopControls(
- "http://thing.originalwebsite.com", ConnectionSecurityLevel.SECURITY_ERROR));
- assertTrue(getActivity().shouldShowTopControls(
- WEBAPP_URL, ConnectionSecurityLevel.SECURITY_WARNING));
- assertTrue(getActivity().shouldShowTopControls(
- WEBAPP_URL + "/things.html", ConnectionSecurityLevel.SECURITY_WARNING));
- assertTrue(getActivity().shouldShowTopControls(
- WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.SECURITY_WARNING));
+ assertTrue(shouldShowTopControls(WEBAPP_URL, "http://sub.originalwebsite.com",
+ ConnectionSecurityLevel.SECURITY_WARNING));
+ assertTrue(shouldShowTopControls(WEBAPP_URL, "http://notoriginalwebsite.com",
+ ConnectionSecurityLevel.SECURITY_ERROR));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, "http://otherwebsite.com", ConnectionSecurityLevel.SECURITY_ERROR));
+ assertTrue(shouldShowTopControls(WEBAPP_URL, "http://thing.originalwebsite.com",
+ ConnectionSecurityLevel.SECURITY_ERROR));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, WEBAPP_URL, ConnectionSecurityLevel.SECURITY_WARNING));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, WEBAPP_URL + "/things.html", ConnectionSecurityLevel.SECURITY_WARNING));
+ assertTrue(shouldShowTopControls(
+ WEBAPP_URL, WEBAPP_URL + "/stuff.html", ConnectionSecurityLevel.SECURITY_WARNING));
+ }
+
+ /**
+ * Convenience wrapper for WebappDelegateFactory.TopControlsDelegate#shouldShowTopControls()
+ */
+ private static boolean shouldShowTopControls(
+ String webappStartUrl, String url, int securityLevel) {
+ return WebappDelegateFactory.TopControlsDelegate.shouldShowTopControls(
+ webappStartUrl, url, securityLevel);
}
}
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698