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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java

Issue 2790893004: Delete Android content detectors. (Closed)
Patch Set: Rebase Created 3 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 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.browser;
6
7 import android.support.test.filters.LargeTest;
8 import android.support.test.filters.MediumTest;
9
10 import org.chromium.base.test.util.CommandLineFlags;
11 import org.chromium.base.test.util.DisabledTest;
12 import org.chromium.base.test.util.Feature;
13 import org.chromium.base.test.util.RetryOnFailure;
14 import org.chromium.content.common.ContentSwitches;
15
16 /**
17 * Test suite for phone number detection.
18 */
19 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
20 public class PhoneNumberDetectionTest extends ContentDetectionTestBase {
21
22 private static final String TELEPHONE_INTENT_PREFIX = "tel:";
23
24 private boolean isExpectedTelephoneIntent(String intentUrl, String expectedC ontent) {
25 if (intentUrl == null) return false;
26 final String expectedUrl = TELEPHONE_INTENT_PREFIX + urlForContent(expec tedContent);
27 return intentUrl.equals(expectedUrl);
28 }
29
30 @LargeTest
31 @Feature({"ContentDetection", "TabContents"})
32 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US")
33 @RetryOnFailure
34 public void testInternationalNumberIntents() throws Throwable {
35 startActivityWithTestUrl(
36 "content/test/data/android/content_detection/phone_international .html");
37
38 // US: +1 650-253-0000.
39 String intentUrl = scrollAndTapExpectingIntent("US");
40 assertTrue(isExpectedTelephoneIntent(intentUrl, "+16502530000"));
41
42 // Australia: +61 2 9374 4000.
43 intentUrl = scrollAndTapExpectingIntent("Australia");
44 assertTrue(isExpectedTelephoneIntent(intentUrl, "+61293744000"));
45
46 // China: +86-10-62503000.
47 intentUrl = scrollAndTapExpectingIntent("China");
48 assertTrue(isExpectedTelephoneIntent(intentUrl, "+861062503000"));
49
50 // Hong Kong: +852-3923-5400.
51 intentUrl = scrollAndTapExpectingIntent("Hong Kong");
52 assertTrue(isExpectedTelephoneIntent(intentUrl, "+85239235400"));
53
54 // India: +91-80-67218000.
55 intentUrl = scrollAndTapExpectingIntent("India");
56 assertTrue(isExpectedTelephoneIntent(intentUrl, "+918067218000"));
57
58 // Japan: +81-3-6384-9000.
59 intentUrl = scrollAndTapExpectingIntent("Japan");
60 assertTrue(isExpectedTelephoneIntent(intentUrl, "+81363849000"));
61
62 // Korea: +82-2-531-9000.
63 intentUrl = scrollAndTapExpectingIntent("Korea");
64 assertTrue(isExpectedTelephoneIntent(intentUrl, "+8225319000"));
65
66 // Singapore: +65 6521-8000.
67 intentUrl = scrollAndTapExpectingIntent("Singapore");
68 assertTrue(isExpectedTelephoneIntent(intentUrl, "+6565218000"));
69
70 // Taiwan: +886 2 8729 6000.
71 intentUrl = scrollAndTapExpectingIntent("Taiwan");
72 assertTrue(isExpectedTelephoneIntent(intentUrl, "+886287296000"));
73
74 // Kenya: +254 20 360 1000.
75 intentUrl = scrollAndTapExpectingIntent("Kenya");
76 assertTrue(isExpectedTelephoneIntent(intentUrl, "+254203601000"));
77
78 // France: +33 (0)1 42 68 53 00.
79 intentUrl = scrollAndTapExpectingIntent("France");
80 assertTrue(isExpectedTelephoneIntent(intentUrl, "+33142685300"));
81
82 // Germany: +49 40-80-81-79-000.
83 intentUrl = scrollAndTapExpectingIntent("Germany");
84 assertTrue(isExpectedTelephoneIntent(intentUrl, "+4940808179000"));
85
86 // Ireland: +353 (1) 436 1001.
87 intentUrl = scrollAndTapExpectingIntent("Ireland");
88 assertTrue(isExpectedTelephoneIntent(intentUrl, "+35314361001"));
89
90 // Italy: +39 02-36618 300.
91 intentUrl = scrollAndTapExpectingIntent("Italy");
92 assertTrue(isExpectedTelephoneIntent(intentUrl, "+390236618300"));
93
94 // Netherlands: +31 (0)20-5045-100.
95 intentUrl = scrollAndTapExpectingIntent("Netherlands");
96 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100"));
97
98 // Norway: +47 22996288.
99 intentUrl = scrollAndTapExpectingIntent("Norway");
100 assertTrue(isExpectedTelephoneIntent(intentUrl, "+4722996288"));
101
102 // Poland: +48 (12) 68 15 300.
103 intentUrl = scrollAndTapExpectingIntent("Poland");
104 assertTrue(isExpectedTelephoneIntent(intentUrl, "+48126815300"));
105
106 // Russia: +7-495-644-1400.
107 intentUrl = scrollAndTapExpectingIntent("Russia");
108 assertTrue(isExpectedTelephoneIntent(intentUrl, "+74956441400"));
109
110 // Spain: +34 91-748-6400.
111 intentUrl = scrollAndTapExpectingIntent("Spain");
112 assertTrue(isExpectedTelephoneIntent(intentUrl, "+34917486400"));
113
114 // Switzerland: +41 44-668-1800.
115 intentUrl = scrollAndTapExpectingIntent("Switzerland");
116 assertTrue(isExpectedTelephoneIntent(intentUrl, "+41446681800"));
117
118 // UK: +44 (0)20-7031-3000.
119 intentUrl = scrollAndTapExpectingIntent("UK");
120 assertTrue(isExpectedTelephoneIntent(intentUrl, "+442070313000"));
121
122 // Canada: +1 514-670-8700.
123 intentUrl = scrollAndTapExpectingIntent("Canada");
124 assertTrue(isExpectedTelephoneIntent(intentUrl, "+15146708700"));
125
126 // Argentina: +54-11-5530-3000.
127 intentUrl = scrollAndTapExpectingIntent("Argentina");
128 assertTrue(isExpectedTelephoneIntent(intentUrl, "+541155303000"));
129
130 // Brazil: +55-31-2128-6800.
131 intentUrl = scrollAndTapExpectingIntent("Brazil");
132 assertTrue(isExpectedTelephoneIntent(intentUrl, "+553121286800"));
133
134 // Mexico: +52 55-5342-8400.
135 intentUrl = scrollAndTapExpectingIntent("Mexico");
136 assertTrue(isExpectedTelephoneIntent(intentUrl, "+525553428400"));
137
138 // Israel: +972-74-746-6245.
139 intentUrl = scrollAndTapExpectingIntent("Israel");
140 assertTrue(isExpectedTelephoneIntent(intentUrl, "+972747466245"));
141
142 // UAE: +971 4 4509500.
143 intentUrl = scrollAndTapExpectingIntent("UAE");
144 assertTrue(isExpectedTelephoneIntent(intentUrl, "+97144509500"));
145 }
146
147 @MediumTest
148 @Feature({"ContentDetection", "TabContents"})
149 @DisabledTest(message = "crbug.com/673279")
150 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US")
151 public void testLocalUSNumbers() throws Throwable {
152 startActivityWithTestUrl(
153 "content/test/data/android/content_detection/phone_local.html");
154
155 // US_1: 1-888-433-5788.
156 String intentUrl = scrollAndTapExpectingIntent("US_1");
157 assertTrue(isExpectedTelephoneIntent(intentUrl, "+18884335788"));
158
159 // US_2: 703-293-6299.
160 intentUrl = scrollAndTapExpectingIntent("US_2");
161 assertTrue(isExpectedTelephoneIntent(intentUrl, "+17032936299"));
162
163 // US_3: (202) 456-2121.
164 intentUrl = scrollAndTapExpectingIntent("US_3");
165 assertTrue(isExpectedTelephoneIntent(intentUrl, "+12024562121"));
166
167 // International numbers should still work.
168 intentUrl = scrollAndTapExpectingIntent("International");
169 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100"));
170 }
171
172 @MediumTest
173 @Feature({"ContentDetection", "TabContents"})
174 @DisabledTest(message = "crbug.com/673279")
175 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=GB")
176 public void testLocalUKNumbers() throws Throwable {
177 startActivityWithTestUrl(
178 "content/test/data/android/content_detection/phone_local.html");
179
180 // GB_1: (0) 20 7323 8299.
181 String intentUrl = scrollAndTapExpectingIntent("GB_1");
182 assertTrue(isExpectedTelephoneIntent(intentUrl, "02073238299"));
183
184 // GB_2: 01227865330.
185 intentUrl = scrollAndTapExpectingIntent("GB_2");
186 assertTrue(isExpectedTelephoneIntent(intentUrl, "01227865330"));
187
188 // GB_3: 01963 824686.
189 intentUrl = scrollAndTapExpectingIntent("GB_3");
190 assertTrue(isExpectedTelephoneIntent(intentUrl, "01963824686"));
191
192 // International numbers should still work.
193 intentUrl = scrollAndTapExpectingIntent("International");
194 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100"));
195 }
196
197 @MediumTest
198 @Feature({"ContentDetection", "TabContents"})
199 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=FR")
200 @RetryOnFailure
201 public void testLocalFRNumbers() throws Throwable {
202 startActivityWithTestUrl(
203 "content/test/data/android/content_detection/phone_local.html");
204
205 // FR_1: 01 40 20 50 50.
206 String intentUrl = scrollAndTapExpectingIntent("FR_1");
207 assertTrue(isExpectedTelephoneIntent(intentUrl, "0140205050"));
208
209 // FR_2: 0326475534.
210 intentUrl = scrollAndTapExpectingIntent("FR_2");
211 assertTrue(isExpectedTelephoneIntent(intentUrl, "0326475534"));
212
213 // FR_3: (0) 237 211 992.
214 intentUrl = scrollAndTapExpectingIntent("FR_3");
215 assertTrue(isExpectedTelephoneIntent(intentUrl, "0237211992"));
216
217 // International numbers should still work.
218 intentUrl = scrollAndTapExpectingIntent("International");
219 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100"));
220 }
221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698