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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/AddressDetectionTest.java

Issue 11085008: [Android] Upstream content detection and ChromeBrowserProvider tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase after landing resources separately. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/AddressDetectionTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/AddressDetectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/AddressDetectionTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..fcf9a90506af58536b9f3e77db03f94ca52e91b2
--- /dev/null
+++ b/content/public/android/javatests/src/org/chromium/content/browser/AddressDetectionTest.java
@@ -0,0 +1,102 @@
+// Copyright (c) 2012 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.content.browser;
+
+import android.test.suitebuilder.annotation.MediumTest;
+
+import org.chromium.base.test.util.DisabledTest;
+import org.chromium.base.test.util.Feature;
+
+/**
+ * Test suite for geographical US address detection.
+ */
+public class AddressDetectionTest extends ContentDetectionTestBase {
+
+ private static final String GEO_INTENT_PREFIX = "geo:0,0?q=";
+
+ private boolean isExpectedGeoIntent(String intentUrl, String expectedContent) {
+ if (intentUrl == null) return false;
+ final String expectedUrl = GEO_INTENT_PREFIX + urlForContent(expectedContent);
+ return intentUrl.equals(expectedUrl);
+ }
+
+ @MediumTest
+ @Feature({"ContentDetection", "TabContents"})
+ public void testMultipleAddressesInText() throws Throwable {
+ startActivityWithTestUrl("content/content_detection/geo_address_multiple.html");
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
+ "1600 Amphitheatre Parkway Mountain View, CA 94043"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"),
+ "76 Ninth Avenue 4th Floor New York, NY 10011"));
+ }
+
+ @MediumTest
+ @Feature({"ContentDetection", "TabContents"})
+ public void testSplitAddresses() throws Throwable {
+ startActivityWithTestUrl("content/content_detection/geo_address_split.html");
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
+ "9606 North MoPac Expressway Suite 400 Austin, TX 78759"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"),
+ "1818 Library Street Suite 400, VA 20190"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"),
+ "1818 Library Street Suite 400, VA 20190"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"),
+ "1818 Library Street Suite 400, VA 20190"));
+ }
+
+ @MediumTest
+ @Feature({"ContentDetection", "TabContents"})
+ public void testAddressLimits() throws Throwable {
+ startActivityWithTestUrl("content/content_detection/geo_address_limits.html");
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
+ "2590 Pearl Street Suite 100 Boulder, CO 80302"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"),
+ "6425 Penn Ave. Suite 700 Pittsburgh, PA 15206"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"),
+ "34 Main St. Boston, MA 02118"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"),
+ "1600 Amphitheatre Parkway Mountain View, CA 94043"));
+ }
+
+ @MediumTest
+ @Feature({"ContentDetection", "TabContents"})
+ public void testRealAddresses() throws Throwable {
+ startActivityWithTestUrl("content/content_detection/geo_address_real.html");
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
+ "57th Street and Lake Shore Drive Chicago, IL 60637"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"),
+ "57th Street and Lake Shore Drive Chicago, IL 60637"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"),
+ "57th Street and Lake Shore Drive Chicago, IL 60637"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"),
+ "79th Street, New York, NY, 10024-5192"));
+ }
+
+ @MediumTest
+ @Feature({"ContentDetection", "TabContents"})
+ public void testSpecialChars() throws Throwable {
+ startActivityWithTestUrl("content/content_detection/geo_address_special_chars.html");
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"),
+ "100 34th Avenue , San Francisco, CA 94121"));
+
+ assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"),
+ "100 34th Avenue San Francisco, CA 94121"));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698