OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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.content_shell; | |
6 | |
7 import android.test.suitebuilder.annotation.MediumTest; | |
8 | |
9 import org.chromium.base.test.util.DisabledTest; | |
10 import org.chromium.base.test.util.Feature; | |
11 | |
12 /** | |
13 * Test suite for geographical US address detection. | |
14 */ | |
15 public class AddressDetectionTest extends ContentDetectionTestBase { | |
klundberg
2012/10/09 17:07:01
So the test should in general live next to the cod
Leandro GraciĆ” Gil
2012/10/10 00:35:54
Done.
| |
16 | |
17 private static final String GEO_INTENT_PREFIX = "geo:0,0?q="; | |
18 | |
19 private boolean isExpectedGeoIntent(String intentUrl, String expectedContent ) { | |
20 if (intentUrl == null) return false; | |
21 final String expectedUrl = GEO_INTENT_PREFIX + urlForContent(expectedCon tent); | |
22 return intentUrl.equals(expectedUrl); | |
23 } | |
24 | |
25 @MediumTest | |
26 @Feature({"ContentDetection", "TabContents"}) | |
27 public void testMultipleAddressesInText() throws Throwable { | |
28 startActivityWithTestUrl("content/content_detection/geo_address_multiple .html"); | |
29 | |
30 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"), | |
31 "1600 Amphitheatre Parkway Mountain View, CA 94043")); | |
32 | |
33 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"), | |
34 "76 Ninth Avenue 4th Floor New York, NY 10011")); | |
35 } | |
36 | |
37 @MediumTest | |
38 @Feature({"ContentDetection", "TabContents"}) | |
39 public void testSplitAddresses() throws Throwable { | |
40 startActivityWithTestUrl("content/content_detection/geo_address_split.ht ml"); | |
41 | |
42 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"), | |
43 "9606 North MoPac Expressway Suite 400 Austin, TX 78759")); | |
44 | |
45 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"), | |
46 "1818 Library Street Suite 400, VA 20190")); | |
47 | |
48 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"), | |
49 "1818 Library Street Suite 400, VA 20190")); | |
50 | |
51 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"), | |
52 "1818 Library Street Suite 400, VA 20190")); | |
53 } | |
54 | |
55 @MediumTest | |
56 @Feature({"ContentDetection", "TabContents"}) | |
57 public void testAddressLimits() throws Throwable { | |
58 startActivityWithTestUrl("content/content_detection/geo_address_limits.h tml"); | |
59 | |
60 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"), | |
61 "2590 Pearl Street Suite 100 Boulder, CO 80302")); | |
62 | |
63 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"), | |
64 "6425 Penn Ave. Suite 700 Pittsburgh, PA 15206")); | |
65 | |
66 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"), | |
67 "34 Main St. Boston, MA 02118")); | |
68 | |
69 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"), | |
70 "1600 Amphitheatre Parkway Mountain View, CA 94043")); | |
71 } | |
72 | |
73 @MediumTest | |
74 @Feature({"ContentDetection", "TabContents"}) | |
75 public void testRealAddresses() throws Throwable { | |
76 startActivityWithTestUrl("content/content_detection/geo_address_real.htm l"); | |
77 | |
78 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"), | |
79 "57th Street and Lake Shore Drive Chicago, IL 60637")); | |
80 | |
81 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"), | |
82 "57th Street and Lake Shore Drive Chicago, IL 60637")); | |
83 | |
84 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test3"), | |
85 "57th Street and Lake Shore Drive Chicago, IL 60637")); | |
86 | |
87 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test4"), | |
88 "79th Street, New York, NY, 10024-5192")); | |
89 } | |
90 | |
91 @MediumTest | |
92 @Feature({"ContentDetection", "TabContents"}) | |
93 public void testSpecialChars() throws Throwable { | |
94 startActivityWithTestUrl("content/content_detection/geo_address_special_ chars.html"); | |
95 | |
96 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test1"), | |
97 "100 34th Avenue , San Francisco, CA 94121")); | |
98 | |
99 assertTrue(isExpectedGeoIntent(scrollAndTapExpectingIntent("test2"), | |
100 "100 34th Avenue San Francisco, CA 94121")); | |
101 } | |
102 } | |
OLD | NEW |