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

Side by Side Diff: chrome/android/junit/src/org/chromium/chrome/browser/ShortcutHelperTest.java

Issue 1845233002: Store standalone web app data in WebappDataStorage as well as the homescreen intent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-deep-linking
Patch Set: Final nit Created 4 years, 8 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 2016 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;
6
7 import static org.junit.Assert.assertEquals;
8
9 import org.chromium.testing.local.LocalRobolectricTestRunner;
10 import org.junit.Test;
11 import org.junit.runner.RunWith;
12 import org.robolectric.annotation.Config;
13
14 /**
15 * Unit tests for {@link org.chromium.chrome.browser.ShortcutHelper}.
16 */
17 @RunWith(LocalRobolectricTestRunner.class)
18 @Config(manifest = Config.NONE)
19 public class ShortcutHelperTest {
20
21 /**
22 * Test method for {@link ShortcutHelper#getScopeFromUrl.}
23 */
24 @Test
25 public void testGetScopeFromUrl() {
26 String url1 = "https://www.google.com";
27 String url2 = "https://www.google.com/";
28 String url3 = "https://www.google.com/maps";
29 String url4 = "https://www.google.com/maps/";
30 String url5 = "https://www.google.com/index.html";
31 String url6 = "https://www.google.com/index.html?q=maps";
32 String url7 = "https://www.google.com/index.html#maps/";
33 String url8 = "https://www.google.com/maps/au/index.html";
34 String url9 = "https://www.google.com/maps/au/north";
35 String url10 = "https://www.google.com/maps/au/north/";
36 String url11 = "https://www.google.com/maps/au/index.html?q=maps#fragmen t/";
37 String url12 = "http://www.google.com:8000/maps/au/index.html?q=maps#fra gment/";
38
39 String url2_scope = "https://www.google.com/";
40 String url8_scope = "https://www.google.com/maps/au/";
41 String url12_scope = "http://www.google.com:8000/maps/au/";
42
43 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url1));
44 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url2));
45 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url3));
46 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url4));
47 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url5));
48 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url6));
49 assertEquals(url2_scope, ShortcutHelper.getScopeFromUrl(url7));
50 assertEquals(url8_scope, ShortcutHelper.getScopeFromUrl(url8));
51 assertEquals(url8_scope, ShortcutHelper.getScopeFromUrl(url9));
52 assertEquals(url8_scope, ShortcutHelper.getScopeFromUrl(url10));
53 assertEquals(url8_scope, ShortcutHelper.getScopeFromUrl(url11));
54 assertEquals(url12_scope, ShortcutHelper.getScopeFromUrl(url12));
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698