| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; | 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; |
| 8 | 8 |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.app.Application; | 10 import android.app.Application; |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 CriteriaHelper.pollInstrumentationThread( | 1207 CriteriaHelper.pollInstrumentationThread( |
| 1208 new TabsOpenedFromExternalAppTest.ReferrerCriteria(tab, referrer
Url), 2000, 200); | 1208 new TabsOpenedFromExternalAppTest.ReferrerCriteria(tab, referrer
Url), 2000, 200); |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 /** | 1211 /** |
| 1212 * Tests that a Weblite URL from an external app uses the lite_url param whe
n Data Reduction | 1212 * Tests that a Weblite URL from an external app uses the lite_url param whe
n Data Reduction |
| 1213 * Proxy previews are being used. | 1213 * Proxy previews are being used. |
| 1214 */ | 1214 */ |
| 1215 @SmallTest | 1215 @SmallTest |
| 1216 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", | 1216 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", |
| 1217 "enable-data-reduction-proxy-lo-fi-preview"}) | 1217 "enable-data-reduction-proxy-lite-page"}) |
| 1218 @RetryOnFailure | 1218 @RetryOnFailure |
| 1219 public void testLaunchWebLiteURL() throws Exception { | 1219 public void testLaunchWebLiteURL() throws Exception { |
| 1220 final String testUrl = WEBLITE_PREFIX + mTestPage; | 1220 final String testUrl = WEBLITE_PREFIX + mTestPage; |
| 1221 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1221 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1222 getInstrumentation().getTargetContext(), testUrl)); | 1222 getInstrumentation().getTargetContext(), testUrl)); |
| 1223 Tab tab = getActivity().getActivityTab(); | 1223 Tab tab = getActivity().getActivityTab(); |
| 1224 assertEquals(mTestPage, tab.getUrl()); | 1224 assertEquals(mTestPage, tab.getUrl()); |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 /** | 1227 /** |
| 1228 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data | 1228 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data |
| 1229 * Reduction Proxy previews are not being used. | 1229 * Reduction Proxy previews are not being used. |
| 1230 */ | 1230 */ |
| 1231 @SmallTest | 1231 @SmallTest |
| 1232 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on"}) | 1232 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on"}) |
| 1233 @RetryOnFailure | 1233 @RetryOnFailure |
| 1234 public void testLaunchWebLiteURLNoPreviews() throws Exception { | 1234 public void testLaunchWebLiteURLNoPreviews() throws Exception { |
| 1235 final String testUrl = WEBLITE_PREFIX + mTestPage; | 1235 final String testUrl = WEBLITE_PREFIX + mTestPage; |
| 1236 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1236 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1237 getInstrumentation().getTargetContext(), testUrl)); | 1237 getInstrumentation().getTargetContext(), testUrl)); |
| 1238 Tab tab = getActivity().getActivityTab(); | 1238 Tab tab = getActivity().getActivityTab(); |
| 1239 assertEquals(testUrl, tab.getUrl()); | 1239 assertEquals(testUrl, tab.getUrl()); |
| 1240 } | 1240 } |
| 1241 | 1241 |
| 1242 /** | 1242 /** |
| 1243 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data | 1243 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data |
| 1244 * Reduction Proxy is not using Lo-Fi. | 1244 * Reduction Proxy is not using Lo-Fi. |
| 1245 */ | 1245 */ |
| 1246 @SmallTest | 1246 @SmallTest |
| 1247 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "enable-data-reduction-prox
y-lo-fi-preview"}) | 1247 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "enable-data-reduction-prox
y-lite-page"}) |
| 1248 @RetryOnFailure | 1248 @RetryOnFailure |
| 1249 public void testLaunchWebLiteURLNoLoFi() throws Exception { | 1249 public void testLaunchWebLiteURLNoLoFi() throws Exception { |
| 1250 final String testUrl = WEBLITE_PREFIX + mTestPage; | 1250 final String testUrl = WEBLITE_PREFIX + mTestPage; |
| 1251 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1251 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1252 getInstrumentation().getTargetContext(), testUrl)); | 1252 getInstrumentation().getTargetContext(), testUrl)); |
| 1253 Tab tab = getActivity().getActivityTab(); | 1253 Tab tab = getActivity().getActivityTab(); |
| 1254 assertEquals(testUrl, tab.getUrl()); | 1254 assertEquals(testUrl, tab.getUrl()); |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 /** | 1257 /** |
| 1258 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data | 1258 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when Data |
| 1259 * Reduction Proxy is not being used. | 1259 * Reduction Proxy is not being used. |
| 1260 */ | 1260 */ |
| 1261 @SmallTest | 1261 @SmallTest |
| 1262 @CommandLineFlags.Add({"data-reduction-proxy-lo-fi=always-on", | 1262 @CommandLineFlags.Add({"data-reduction-proxy-lo-fi=always-on", |
| 1263 "enable-data-reduction-proxy-lo-fi-preview"}) | 1263 "enable-data-reduction-proxy-lite-page"}) |
| 1264 @RetryOnFailure | 1264 @RetryOnFailure |
| 1265 public void testLaunchWebLiteURLNoDataReductionProxy() throws Exception { | 1265 public void testLaunchWebLiteURLNoDataReductionProxy() throws Exception { |
| 1266 final String testUrl = WEBLITE_PREFIX + mTestPage; | 1266 final String testUrl = WEBLITE_PREFIX + mTestPage; |
| 1267 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1267 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1268 getInstrumentation().getTargetContext(), testUrl)); | 1268 getInstrumentation().getTargetContext(), testUrl)); |
| 1269 Tab tab = getActivity().getActivityTab(); | 1269 Tab tab = getActivity().getActivityTab(); |
| 1270 assertEquals(testUrl, tab.getUrl()); | 1270 assertEquals(testUrl, tab.getUrl()); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 /** | 1273 /** |
| 1274 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when the param | 1274 * Tests that a Weblite URL from an external app does not use the lite_url p
aram when the param |
| 1275 * is an https URL. | 1275 * is an https URL. |
| 1276 */ | 1276 */ |
| 1277 @SmallTest | 1277 @SmallTest |
| 1278 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", | 1278 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", |
| 1279 "enable-data-reduction-proxy-lo-fi-preview"}) | 1279 "enable-data-reduction-proxy-lite-page"}) |
| 1280 @RetryOnFailure | 1280 @RetryOnFailure |
| 1281 public void testLaunchHttpsWebLiteURL() throws Exception { | 1281 public void testLaunchHttpsWebLiteURL() throws Exception { |
| 1282 final String testUrl = WEBLITE_PREFIX + mTestPage.replaceFirst("http", "
https"); | 1282 final String testUrl = WEBLITE_PREFIX + mTestPage.replaceFirst("http", "
https"); |
| 1283 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1283 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1284 getInstrumentation().getTargetContext(), testUrl)); | 1284 getInstrumentation().getTargetContext(), testUrl)); |
| 1285 Tab tab = getActivity().getActivityTab(); | 1285 Tab tab = getActivity().getActivityTab(); |
| 1286 assertEquals(testUrl, tab.getUrl()); | 1286 assertEquals(testUrl, tab.getUrl()); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 /** | 1289 /** |
| 1290 * Tests that a URL from an external app does not use the lite_url param whe
n the prefix is not | 1290 * Tests that a URL from an external app does not use the lite_url param whe
n the prefix is not |
| 1291 * the WebLite url. | 1291 * the WebLite url. |
| 1292 */ | 1292 */ |
| 1293 @SmallTest | 1293 @SmallTest |
| 1294 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", | 1294 @CommandLineFlags.Add({"enable-spdy-proxy-auth", "data-reduction-proxy-lo-fi
=always-on", |
| 1295 "enable-data-reduction-proxy-lo-fi-preview"}) | 1295 "enable-data-reduction-proxy-lite-page"}) |
| 1296 @RetryOnFailure | 1296 @RetryOnFailure |
| 1297 public void testLaunchNonWebLiteURL() throws Exception { | 1297 public void testLaunchNonWebLiteURL() throws Exception { |
| 1298 final String testUrl = mTestPage2 + "/?lite_url=" + mTestPage; | 1298 final String testUrl = mTestPage2 + "/?lite_url=" + mTestPage; |
| 1299 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 1299 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 1300 getInstrumentation().getTargetContext(), testUrl)); | 1300 getInstrumentation().getTargetContext(), testUrl)); |
| 1301 Tab tab = getActivity().getActivityTab(); | 1301 Tab tab = getActivity().getActivityTab(); |
| 1302 assertEquals(testUrl, tab.getUrl()); | 1302 assertEquals(testUrl, tab.getUrl()); |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 /** Maybe prerenders a URL with a referrer, then launch it with another one.
*/ | 1305 /** Maybe prerenders a URL with a referrer, then launch it with another one.
*/ |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; | 1550 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; |
| 1551 value = jsonText; | 1551 value = jsonText; |
| 1552 } catch (InterruptedException | TimeoutException e) { | 1552 } catch (InterruptedException | TimeoutException e) { |
| 1553 e.printStackTrace(); | 1553 e.printStackTrace(); |
| 1554 return false; | 1554 return false; |
| 1555 } | 1555 } |
| 1556 return TextUtils.equals(mExpected, value); | 1556 return TextUtils.equals(mExpected, value); |
| 1557 } | 1557 } |
| 1558 } | 1558 } |
| 1559 } | 1559 } |
| OLD | NEW |