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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.webapps;
6
7 import android.test.FlakyTest;
8
9 import org.chromium.chrome.browser.ssl.ConnectionSecurityHelperSecurityLevel;
10 import org.chromium.content_public.common.ScreenOrientationValues;
11
12 /**
13 * Tests whether the URL bar updates itself properly.
14 */
15 public class WebappUrlBarTest extends WebappActivityTestBase {
16 private static final String WEBAPP_URL = "http://originalwebsite.com";
17 private WebappUrlBar mUrlBar;
18
19 @Override
20 protected void setUp() throws Exception {
21 super.setUp();
22
23 WebappInfo mockInfo = WebappInfo.create(WEBAPP_ID, WEBAPP_URL, null, nul l,
24 ScreenOrientationValues.DEFAULT);
25 getActivity().getWebappInfo().copy(mockInfo);
26 mUrlBar = getActivity().getUrlBarForTests();
27 }
28
29 /*
30 @UiThreadTest
31 @MediumTest
32 @Feature({"Webapps"})
33 crbug/407332
34 */
35 @FlakyTest
36 public void testUrlDisplay() {
37 final String scheme = "somescheme://";
38 final String host = "lorem.com";
39 final String path = "/stuff/and/things.html";
40 final String url = scheme + host + path;
41 final String urlExpectedWhenIconNotShown = scheme + host;
42 final String urlExpectedWhenIconShown = host;
43 final int[] securityLevels = {
44 ConnectionSecurityHelperSecurityLevel.NONE,
45 ConnectionSecurityHelperSecurityLevel.EV_SECURE,
46 ConnectionSecurityHelperSecurityLevel.SECURE,
47 ConnectionSecurityHelperSecurityLevel.SECURITY_WARNING,
48 ConnectionSecurityHelperSecurityLevel.SECURITY_POLICY_WARNING,
49 ConnectionSecurityHelperSecurityLevel.SECURITY_ERROR };
50
51 for (int i : securityLevels) {
52 // http://crbug.com/297249
53 if (i == ConnectionSecurityHelperSecurityLevel.SECURITY_POLICY_WARNI NG) continue;
54 mUrlBar.update(url, i);
55
56 int iconResource = mUrlBar.getCurrentIconResourceForTests();
57 if (iconResource == 0) {
58 assertEquals(
59 urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForT ests().toString());
60 } else {
61 assertEquals(
62 urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTest s().toString());
63 }
64 }
65 }
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698