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

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

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..cf228680a2fd30b596a8b5e730e5015ddfafccd8
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappUrlBarTest.java
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.webapps;
+
+import android.test.FlakyTest;
+
+import org.chromium.chrome.browser.ssl.ConnectionSecurityHelperSecurityLevel;
+import org.chromium.content_public.common.ScreenOrientationValues;
+
+/**
+ * Tests whether the URL bar updates itself properly.
+ */
+public class WebappUrlBarTest extends WebappActivityTestBase {
+ private static final String WEBAPP_URL = "http://originalwebsite.com";
+ private WebappUrlBar mUrlBar;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ WebappInfo mockInfo = WebappInfo.create(WEBAPP_ID, WEBAPP_URL, null, null,
+ ScreenOrientationValues.DEFAULT);
+ getActivity().getWebappInfo().copy(mockInfo);
+ mUrlBar = getActivity().getUrlBarForTests();
+ }
+
+ /*
+ @UiThreadTest
+ @MediumTest
+ @Feature({"Webapps"})
+ crbug/407332
+ */
+ @FlakyTest
+ public void testUrlDisplay() {
+ final String scheme = "somescheme://";
+ final String host = "lorem.com";
+ final String path = "/stuff/and/things.html";
+ final String url = scheme + host + path;
+ final String urlExpectedWhenIconNotShown = scheme + host;
+ final String urlExpectedWhenIconShown = host;
+ final int[] securityLevels = {
+ ConnectionSecurityHelperSecurityLevel.NONE,
+ ConnectionSecurityHelperSecurityLevel.EV_SECURE,
+ ConnectionSecurityHelperSecurityLevel.SECURE,
+ ConnectionSecurityHelperSecurityLevel.SECURITY_WARNING,
+ ConnectionSecurityHelperSecurityLevel.SECURITY_POLICY_WARNING,
+ ConnectionSecurityHelperSecurityLevel.SECURITY_ERROR };
+
+ for (int i : securityLevels) {
+ // http://crbug.com/297249
+ if (i == ConnectionSecurityHelperSecurityLevel.SECURITY_POLICY_WARNING) continue;
+ mUrlBar.update(url, i);
+
+ int iconResource = mUrlBar.getCurrentIconResourceForTests();
+ if (iconResource == 0) {
+ assertEquals(
+ urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForTests().toString());
+ } else {
+ assertEquals(
+ urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTests().toString());
+ }
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698