OLD | NEW |
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.content.Intent; |
7 import android.test.UiThreadTest; | 8 import android.test.UiThreadTest; |
8 import android.test.suitebuilder.annotation.MediumTest; | 9 import android.test.suitebuilder.annotation.MediumTest; |
9 | 10 |
10 import org.chromium.base.test.util.Feature; | 11 import org.chromium.base.test.util.Feature; |
11 import org.chromium.chrome.browser.ShortcutHelper; | 12 import org.chromium.chrome.browser.ShortcutHelper; |
12 import org.chromium.chrome.browser.ShortcutSource; | |
13 import org.chromium.components.security_state.ConnectionSecurityLevel; | 13 import org.chromium.components.security_state.ConnectionSecurityLevel; |
14 import org.chromium.content_public.common.ScreenOrientationValues; | |
15 | 14 |
16 /** | 15 /** |
17 * Tests whether the URL bar updates itself properly. | 16 * Tests whether the URL bar updates itself properly. |
18 */ | 17 */ |
19 public class WebappUrlBarTest extends WebappActivityTestBase { | 18 public class WebappUrlBarTest extends WebappActivityTestBase { |
20 private static final String WEBAPP_URL = "http://originalwebsite.com"; | 19 private static final String WEBAPP_URL = "http://originalwebsite.com"; |
21 private WebappUrlBar mUrlBar; | 20 private WebappUrlBar mUrlBar; |
22 | 21 |
23 @Override | 22 @Override |
| 23 protected Intent createIntent() { |
| 24 Intent intent = super.createIntent(); |
| 25 intent.putExtra(ShortcutHelper.EXTRA_URL, WEBAPP_URL); |
| 26 return intent; |
| 27 } |
| 28 |
| 29 @Override |
24 protected void setUp() throws Exception { | 30 protected void setUp() throws Exception { |
25 super.setUp(); | 31 super.setUp(); |
26 startWebappActivity(); | 32 startWebappActivity(); |
27 | |
28 WebappInfo mockInfo = WebappInfo.create(WEBAPP_ID, WEBAPP_URL, null, nul
l, null, | |
29 ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN, | |
30 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, | |
31 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); | |
32 getActivity().getWebappInfo().copy(mockInfo); | |
33 mUrlBar = getActivity().getUrlBarForTests(); | 33 mUrlBar = getActivity().getUrlBarForTests(); |
34 } | 34 } |
35 | 35 |
36 @UiThreadTest | 36 @UiThreadTest |
37 @MediumTest | 37 @MediumTest |
38 @Feature({"Webapps"}) | 38 @Feature({"Webapps"}) |
39 public void testUrlDisplay() { | 39 public void testUrlDisplay() { |
40 final String scheme = "https://"; | 40 final String scheme = "https://"; |
41 final String host = "lorem.com"; | 41 final String host = "lorem.com"; |
42 final String path = "/stuff/and/things.html"; | 42 final String path = "/stuff/and/things.html"; |
(...skipping 15 matching lines...) Expand all Loading... |
58 if (iconResource == 0) { | 58 if (iconResource == 0) { |
59 assertEquals( | 59 assertEquals( |
60 urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForT
ests().toString()); | 60 urlExpectedWhenIconNotShown, mUrlBar.getDisplayedUrlForT
ests().toString()); |
61 } else { | 61 } else { |
62 assertEquals( | 62 assertEquals( |
63 urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTest
s().toString()); | 63 urlExpectedWhenIconShown, mUrlBar.getDisplayedUrlForTest
s().toString()); |
64 } | 64 } |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
OLD | NEW |