OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.test.suitebuilder.annotation.LargeTest; | 7 import android.test.suitebuilder.annotation.LargeTest; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
9 | 9 |
10 import org.chromium.base.test.util.CommandLineFlags; | 10 import org.chromium.base.test.util.CommandLineFlags; |
(...skipping 12 matching lines...) Expand all Loading... |
23 final String expectedUrl = TELEPHONE_INTENT_PREFIX + urlForContent(expec
tedContent); | 23 final String expectedUrl = TELEPHONE_INTENT_PREFIX + urlForContent(expec
tedContent); |
24 return intentUrl.equals(expectedUrl); | 24 return intentUrl.equals(expectedUrl); |
25 } | 25 } |
26 | 26 |
27 @LargeTest | 27 @LargeTest |
28 @Feature({"ContentDetection", "TabContents"}) | 28 @Feature({"ContentDetection", "TabContents"}) |
29 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US") | 29 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US") |
30 public void testInternationalNumberIntents() throws Throwable { | 30 public void testInternationalNumberIntents() throws Throwable { |
31 startActivityWithTestUrl( | 31 startActivityWithTestUrl( |
32 "content/test/data/android/content_detection/phone_international
.html"); | 32 "content/test/data/android/content_detection/phone_international
.html"); |
| 33 assertWaitForPageScaleFactorMatch(1.0f); |
33 | 34 |
34 // US: +1 650-253-0000. | 35 // US: +1 650-253-0000. |
35 String intentUrl = scrollAndTapExpectingIntent("US"); | 36 String intentUrl = scrollAndTapExpectingIntent("US"); |
36 assertTrue(isExpectedTelephoneIntent(intentUrl, "+16502530000")); | 37 assertTrue(isExpectedTelephoneIntent(intentUrl, "+16502530000")); |
37 | 38 |
38 // Australia: +61 2 9374 4000. | 39 // Australia: +61 2 9374 4000. |
39 intentUrl = scrollAndTapExpectingIntent("Australia"); | 40 intentUrl = scrollAndTapExpectingIntent("Australia"); |
40 assertTrue(isExpectedTelephoneIntent(intentUrl, "+61293744000")); | 41 assertTrue(isExpectedTelephoneIntent(intentUrl, "+61293744000")); |
41 | 42 |
42 // China: +86-10-62503000. | 43 // China: +86-10-62503000. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 intentUrl = scrollAndTapExpectingIntent("UAE"); | 140 intentUrl = scrollAndTapExpectingIntent("UAE"); |
140 assertTrue(isExpectedTelephoneIntent(intentUrl, "+97144509500")); | 141 assertTrue(isExpectedTelephoneIntent(intentUrl, "+97144509500")); |
141 } | 142 } |
142 | 143 |
143 @MediumTest | 144 @MediumTest |
144 @Feature({"ContentDetection", "TabContents"}) | 145 @Feature({"ContentDetection", "TabContents"}) |
145 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US") | 146 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=US") |
146 public void testLocalUSNumbers() throws Throwable { | 147 public void testLocalUSNumbers() throws Throwable { |
147 startActivityWithTestUrl( | 148 startActivityWithTestUrl( |
148 "content/test/data/android/content_detection/phone_local.html"); | 149 "content/test/data/android/content_detection/phone_local.html"); |
| 150 assertWaitForPageScaleFactorMatch(1.0f); |
149 | 151 |
150 // US_1: 1-888-433-5788. | 152 // US_1: 1-888-433-5788. |
151 String intentUrl = scrollAndTapExpectingIntent("US_1"); | 153 String intentUrl = scrollAndTapExpectingIntent("US_1"); |
152 assertTrue(isExpectedTelephoneIntent(intentUrl, "+18884335788")); | 154 assertTrue(isExpectedTelephoneIntent(intentUrl, "+18884335788")); |
153 | 155 |
154 // US_2: 703-293-6299. | 156 // US_2: 703-293-6299. |
155 intentUrl = scrollAndTapExpectingIntent("US_2"); | 157 intentUrl = scrollAndTapExpectingIntent("US_2"); |
156 assertTrue(isExpectedTelephoneIntent(intentUrl, "+17032936299")); | 158 assertTrue(isExpectedTelephoneIntent(intentUrl, "+17032936299")); |
157 | 159 |
158 // US_3: (202) 456-2121. | 160 // US_3: (202) 456-2121. |
159 intentUrl = scrollAndTapExpectingIntent("US_3"); | 161 intentUrl = scrollAndTapExpectingIntent("US_3"); |
160 assertTrue(isExpectedTelephoneIntent(intentUrl, "+12024562121")); | 162 assertTrue(isExpectedTelephoneIntent(intentUrl, "+12024562121")); |
161 | 163 |
162 // International numbers should still work. | 164 // International numbers should still work. |
163 intentUrl = scrollAndTapExpectingIntent("International"); | 165 intentUrl = scrollAndTapExpectingIntent("International"); |
164 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); | 166 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); |
165 } | 167 } |
166 | 168 |
167 @MediumTest | 169 @MediumTest |
168 @Feature({"ContentDetection", "TabContents"}) | 170 @Feature({"ContentDetection", "TabContents"}) |
169 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=GB") | 171 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=GB") |
170 public void testLocalUKNumbers() throws Throwable { | 172 public void testLocalUKNumbers() throws Throwable { |
171 startActivityWithTestUrl( | 173 startActivityWithTestUrl( |
172 "content/test/data/android/content_detection/phone_local.html"); | 174 "content/test/data/android/content_detection/phone_local.html"); |
| 175 assertWaitForPageScaleFactorMatch(1.0f); |
173 | 176 |
174 // GB_1: (0) 20 7323 8299. | 177 // GB_1: (0) 20 7323 8299. |
175 String intentUrl = scrollAndTapExpectingIntent("GB_1"); | 178 String intentUrl = scrollAndTapExpectingIntent("GB_1"); |
176 assertTrue(isExpectedTelephoneIntent(intentUrl, "02073238299")); | 179 assertTrue(isExpectedTelephoneIntent(intentUrl, "02073238299")); |
177 | 180 |
178 // GB_2: 01227865330. | 181 // GB_2: 01227865330. |
179 intentUrl = scrollAndTapExpectingIntent("GB_2"); | 182 intentUrl = scrollAndTapExpectingIntent("GB_2"); |
180 assertTrue(isExpectedTelephoneIntent(intentUrl, "01227865330")); | 183 assertTrue(isExpectedTelephoneIntent(intentUrl, "01227865330")); |
181 | 184 |
182 // GB_3: 01963 824686. | 185 // GB_3: 01963 824686. |
183 intentUrl = scrollAndTapExpectingIntent("GB_3"); | 186 intentUrl = scrollAndTapExpectingIntent("GB_3"); |
184 assertTrue(isExpectedTelephoneIntent(intentUrl, "01963824686")); | 187 assertTrue(isExpectedTelephoneIntent(intentUrl, "01963824686")); |
185 | 188 |
186 // International numbers should still work. | 189 // International numbers should still work. |
187 intentUrl = scrollAndTapExpectingIntent("International"); | 190 intentUrl = scrollAndTapExpectingIntent("International"); |
188 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); | 191 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); |
189 } | 192 } |
190 | 193 |
191 @MediumTest | 194 @MediumTest |
192 @Feature({"ContentDetection", "TabContents"}) | 195 @Feature({"ContentDetection", "TabContents"}) |
193 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=FR") | 196 @CommandLineFlags.Add(ContentSwitches.NETWORK_COUNTRY_ISO + "=FR") |
194 public void testLocalFRNumbers() throws Throwable { | 197 public void testLocalFRNumbers() throws Throwable { |
195 startActivityWithTestUrl( | 198 startActivityWithTestUrl( |
196 "content/test/data/android/content_detection/phone_local.html"); | 199 "content/test/data/android/content_detection/phone_local.html"); |
| 200 assertWaitForPageScaleFactorMatch(1.0f); |
197 | 201 |
198 // FR_1: 01 40 20 50 50. | 202 // FR_1: 01 40 20 50 50. |
199 String intentUrl = scrollAndTapExpectingIntent("FR_1"); | 203 String intentUrl = scrollAndTapExpectingIntent("FR_1"); |
200 assertTrue(isExpectedTelephoneIntent(intentUrl, "0140205050")); | 204 assertTrue(isExpectedTelephoneIntent(intentUrl, "0140205050")); |
201 | 205 |
202 // FR_2: 0326475534. | 206 // FR_2: 0326475534. |
203 intentUrl = scrollAndTapExpectingIntent("FR_2"); | 207 intentUrl = scrollAndTapExpectingIntent("FR_2"); |
204 assertTrue(isExpectedTelephoneIntent(intentUrl, "0326475534")); | 208 assertTrue(isExpectedTelephoneIntent(intentUrl, "0326475534")); |
205 | 209 |
206 // FR_3: (0) 237 211 992. | 210 // FR_3: (0) 237 211 992. |
207 intentUrl = scrollAndTapExpectingIntent("FR_3"); | 211 intentUrl = scrollAndTapExpectingIntent("FR_3"); |
208 assertTrue(isExpectedTelephoneIntent(intentUrl, "0237211992")); | 212 assertTrue(isExpectedTelephoneIntent(intentUrl, "0237211992")); |
209 | 213 |
210 // International numbers should still work. | 214 // International numbers should still work. |
211 intentUrl = scrollAndTapExpectingIntent("International"); | 215 intentUrl = scrollAndTapExpectingIntent("International"); |
212 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); | 216 assertTrue(isExpectedTelephoneIntent(intentUrl, "+31205045100")); |
213 } | 217 } |
214 } | 218 } |
OLD | NEW |