| Index: tools/chrome_proxy/webdriver/lofi.py
|
| diff --git a/tools/chrome_proxy/webdriver/lofi.py b/tools/chrome_proxy/webdriver/lofi.py
|
| index 0f89d6233eee6322afe4e61bf3e8ef650c4463f7..3c7d132a069b9e27ae5aaf88af6dff92c3380928 100644
|
| --- a/tools/chrome_proxy/webdriver/lofi.py
|
| +++ b/tools/chrome_proxy/webdriver/lofi.py
|
| @@ -42,5 +42,37 @@ class LoFi(IntegrationTest):
|
| # Verify that Lo-Fi responses were seen.
|
| self.assertNotEqual(0, lofi_responses)
|
|
|
| + # Checks that a Lite Page is served and that the ignore_preview_blacklist
|
| + # experiment is being used.
|
| + def testLitePage(self):
|
| + with TestDriver() as test_driver:
|
| + test_driver.AddChromeArg('--enable-spdy-proxy-auth')
|
| + test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on')
|
| + test_driver.AddChromeArg('--enable-data-reduction-proxy-lite-page')
|
| +
|
| + test_driver.LoadURL('http://check.googlezip.net/test.html')
|
| +
|
| + lite_page_responses = 0
|
| + for response in test_driver.GetHTTPResponses():
|
| + # Skip CSI requests when validating Lite Page headers. CSI requests
|
| + # aren't expected to have LoFi headers.
|
| + if '/csi?' in response.url:
|
| + continue
|
| + if response.url.startswith('data:'):
|
| + continue
|
| + chrome_proxy_request = response.request_headers['chrome-proxy']
|
| + cpat_request = response.request_headers['chrome-proxy-accept-transform']
|
| + cpct_response = response.response_headers[
|
| + 'chrome-proxy-content-transform']
|
| + self.assertHasChromeProxyViaHeader(response)
|
| + self.assertIn('exp=ignore_preview_blacklist',
|
| + chrome_proxy_request)
|
| + if ('lite-page' in cpct_response):
|
| + lite_page_responses = lite_page_responses + 1
|
| + self.assertIn('lite-page', cpat_request)
|
| +
|
| + # Verify that a Lite Page response for the main frame was seen.
|
| + self.assertEqual(1, lite_page_responses)
|
| +
|
| if __name__ == '__main__':
|
| IntegrationTest.RunAllTests()
|
|
|