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

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

Issue 1357563002: Expose FormatUrlForSecurityDisplay to Java on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using a fake scheme in the test makes formatUrlForSecurityDisplay be conservative, breaking the tes… Created 5 years, 3 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.test.UiThreadTest; 7 import android.test.UiThreadTest;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 9
10 import org.chromium.base.test.util.Feature; 10 import org.chromium.base.test.util.Feature;
(...skipping 18 matching lines...) Expand all
29 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, 29 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
30 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); 30 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
31 getActivity().getWebappInfo().copy(mockInfo); 31 getActivity().getWebappInfo().copy(mockInfo);
32 mUrlBar = getActivity().getUrlBarForTests(); 32 mUrlBar = getActivity().getUrlBarForTests();
33 } 33 }
34 34
35 @UiThreadTest 35 @UiThreadTest
36 @MediumTest 36 @MediumTest
37 @Feature({"Webapps"}) 37 @Feature({"Webapps"})
38 public void testUrlDisplay() { 38 public void testUrlDisplay() {
39 final String scheme = "somescheme://"; 39 final String scheme = "https://";
40 final String host = "lorem.com"; 40 final String host = "lorem.com";
41 final String path = "/stuff/and/things.html"; 41 final String path = "/stuff/and/things.html";
42 final String url = scheme + host + path; 42 final String url = scheme + host + path;
43 final String urlExpectedWhenIconNotShown = scheme + host; 43 final String urlExpectedWhenIconNotShown = scheme + host;
44 final String urlExpectedWhenIconShown = host; 44 final String urlExpectedWhenIconShown = host;
45 final int[] securityLevels = {ConnectionSecurityLevel.NONE, 45 final int[] securityLevels = {ConnectionSecurityLevel.NONE,
46 ConnectionSecurityLevel.EV_SECURE, ConnectionSecurityLevel.SECUR E, 46 ConnectionSecurityLevel.EV_SECURE, ConnectionSecurityLevel.SECUR E,
47 ConnectionSecurityLevel.SECURITY_WARNING, 47 ConnectionSecurityLevel.SECURITY_WARNING,
48 ConnectionSecurityLevel.SECURITY_POLICY_WARNING, 48 ConnectionSecurityLevel.SECURITY_POLICY_WARNING,
49 ConnectionSecurityLevel.SECURITY_ERROR}; 49 ConnectionSecurityLevel.SECURITY_ERROR};
50 50
51 for (int i : securityLevels) { 51 for (int i : securityLevels) {
52 // http://crbug.com/297249 52 // TODO(palmer): http://crbug.com/297249
53 if (i == ConnectionSecurityLevel.SECURITY_POLICY_WARNING) continue; 53 if (i == ConnectionSecurityLevel.SECURITY_POLICY_WARNING) continue;
54 mUrlBar.update(url, i); 54 mUrlBar.update(url, i);
55 55
56 int iconResource = mUrlBar.getCurrentIconResourceForTests(); 56 int iconResource = mUrlBar.getCurrentIconResourceForTests();
57 if (iconResource == 0) { 57 if (iconResource == 0) {
58 assertEquals( 58 assertEquals(
59 urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForT ests().toString()); 59 urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForT ests().toString());
60 } else { 60 } else {
61 assertEquals( 61 assertEquals(
62 urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTest s().toString()); 62 urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTest s().toString());
63 } 63 }
64 } 64 }
65 } 65 }
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698