Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4afa08c0a86bf456dfe157086f8ee355bf59c6b4 |
--- /dev/null |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappInfoTest.java |
@@ -0,0 +1,56 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.webapps; |
+ |
+import android.content.Intent; |
+import android.test.InstrumentationTestCase; |
+import android.test.suitebuilder.annotation.SmallTest; |
+ |
+import org.chromium.base.test.util.Feature; |
+import org.chromium.chrome.browser.ShortcutHelper; |
+import org.chromium.content_public.common.ScreenOrientationValues; |
+ |
+/** |
+ * Tests the WebappInfo class's ability to parse various URLs. |
+ */ |
+public class WebappInfoTest extends InstrumentationTestCase { |
+ @SmallTest |
+ @Feature({"Webapps"}) |
+ public void testAbout() { |
+ String id = "webapp id"; |
+ String title = "webapp title"; |
+ String url = "about:blank"; |
+ |
+ WebappInfo info = WebappInfo.create(id, url, null, title, ScreenOrientationValues.DEFAULT); |
+ assertNotNull(info); |
+ } |
+ |
+ @SmallTest |
+ @Feature({"Webapps"}) |
+ public void testRandomUrl() { |
+ String id = "webapp id"; |
+ String title = "webapp title"; |
+ String url = "http://google.com"; |
+ |
+ WebappInfo info = WebappInfo.create(id, url, null, title, ScreenOrientationValues.DEFAULT); |
+ assertNotNull(info); |
+ } |
+ |
+ @SmallTest |
+ @Feature({"Webapps"}) |
+ public void testSpacesInUrl() { |
+ String id = "webapp id"; |
+ String title = "webapp title"; |
+ String bustedUrl = "http://money.cnn.com/?category=Latest News"; |
+ |
+ Intent intent = new Intent(); |
+ intent.putExtra(ShortcutHelper.EXTRA_ID, id); |
+ intent.putExtra(ShortcutHelper.EXTRA_TITLE, title); |
+ intent.putExtra(ShortcutHelper.EXTRA_URL, bustedUrl); |
+ |
+ WebappInfo info = WebappInfo.create(intent); |
+ assertNotNull(info); |
+ } |
+} |