Index: tools/chrome_proxy/webdriver/lite_page.py |
diff --git a/tools/chrome_proxy/webdriver/lite_page.py b/tools/chrome_proxy/webdriver/lite_page.py |
index 39b6d43e5b7722152b238d39b096899266a5d094..44b68a9f98fa89aac438ff4752a69e5dd2b0078f 100644 |
--- a/tools/chrome_proxy/webdriver/lite_page.py |
+++ b/tools/chrome_proxy/webdriver/lite_page.py |
@@ -99,7 +99,7 @@ class LitePage(IntegrationTest): |
# Lo-Fi fallback is not currently supported via the client. Check that |
megjablon
2017/06/05 23:47:59
Update this to "Lo-Fi fallback is not supported wi
dougarnett
2017/06/06 16:49:47
Done.
|
# no Lo-Fi response is received if a Lite Page is not served. |
- def testLitePageFallback(self): |
+ def testLitePageNoFallback(self): |
with TestDriver() as test_driver: |
test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
test_driver.AddChromeArg('--force-fieldtrials=' |
@@ -134,5 +134,43 @@ class LitePage(IntegrationTest): |
# Verify that a Lite Page was requested. |
self.assertEqual(1, lite_page_requests) |
+ # Verifies Lo-Fi fallback via the page-policies server directive. |
+ # Note: this test is for the CPAT protocol change in M-61. |
+ def testLitePageFallbackViaPagePolicies(self): |
megjablon
2017/06/05 23:47:59
Please also add tests with DataReductionProxyDecid
dougarnett
2017/06/06 16:49:46
In different CL? I don't see how these tests would
dougarnett
2017/06/07 16:57:49
I went ahead and added my integration tests here f
|
+ with TestDriver() as test_driver: |
+ test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
+ test_driver.AddChromeArg('--enable-features=' |
+ 'DataReductionProxyDecidesTransform') |
+ test_driver.AddChromeArg('--force-fieldtrial-params=' |
+ 'NetworkQualityEstimator.Enabled:' |
+ 'force_effective_connection_type/Slow2G,' |
+ 'DataCompressionProxyLoFi.Enabled_Preview:' |
+ 'effective_connection_type/2G') |
+ test_driver.AddChromeArg('--force-fieldtrials=' |
+ 'NetworkQualityEstimator/Enabled/' |
+ 'DataCompressionProxyLoFi/Enabled_Preview') |
+ |
+ test_driver.LoadURL('http://check.googlezip.net/lite-page-fallback') |
+ |
+ lite_page_responses = 0 |
+ lofi_resource = 0 |
+ for response in test_driver.GetHTTPResponses(): |
+ self.assertEqual('Slow-2G', |
+ response.request_headers['chrome-proxy-ect']) |
+ |
+ if response.url.endswith('html'): |
+ # Verify that the server provides the fallback directive |
+ self.assertIn('page-policies=empty-image', |
+ response.response_headers['chrome-proxy']) |
+ # Main resource should not accept and transform to lite page. |
+ if self.checkLitePageResponse(response): |
+ lite_page_responses = lite_page_responses + 1 |
+ if response.url.endswith('png'): |
+ if self.checkLoFiResponse(response, True): |
+ lofi_resource = lofi_resource + 1 |
+ |
+ self.assertEqual(0, lite_page_responses) |
+ self.assertNotEqual(0, lofi_resource) |
+ |
if __name__ == '__main__': |
IntegrationTest.RunAllTests() |