OLD | NEW |
(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.content.Intent; |
| 8 import android.test.InstrumentationTestCase; |
| 9 import android.test.suitebuilder.annotation.SmallTest; |
| 10 |
| 11 import org.chromium.base.test.util.Feature; |
| 12 import org.chromium.chrome.browser.ShortcutHelper; |
| 13 import org.chromium.content_public.common.ScreenOrientationValues; |
| 14 |
| 15 /** |
| 16 * Tests the WebappInfo class's ability to parse various URLs. |
| 17 */ |
| 18 public class WebappInfoTest extends InstrumentationTestCase { |
| 19 @SmallTest |
| 20 @Feature({"Webapps"}) |
| 21 public void testAbout() { |
| 22 String id = "webapp id"; |
| 23 String title = "webapp title"; |
| 24 String url = "about:blank"; |
| 25 |
| 26 WebappInfo info = WebappInfo.create(id, url, null, title, ScreenOrientat
ionValues.DEFAULT); |
| 27 assertNotNull(info); |
| 28 } |
| 29 |
| 30 @SmallTest |
| 31 @Feature({"Webapps"}) |
| 32 public void testRandomUrl() { |
| 33 String id = "webapp id"; |
| 34 String title = "webapp title"; |
| 35 String url = "http://google.com"; |
| 36 |
| 37 WebappInfo info = WebappInfo.create(id, url, null, title, ScreenOrientat
ionValues.DEFAULT); |
| 38 assertNotNull(info); |
| 39 } |
| 40 |
| 41 @SmallTest |
| 42 @Feature({"Webapps"}) |
| 43 public void testSpacesInUrl() { |
| 44 String id = "webapp id"; |
| 45 String title = "webapp title"; |
| 46 String bustedUrl = "http://money.cnn.com/?category=Latest News"; |
| 47 |
| 48 Intent intent = new Intent(); |
| 49 intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
| 50 intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); |
| 51 intent.putExtra(ShortcutHelper.EXTRA_URL, bustedUrl); |
| 52 |
| 53 WebappInfo info = WebappInfo.create(intent); |
| 54 assertNotNull(info); |
| 55 } |
| 56 } |
OLD | NEW |