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

Unified Diff: tools/chrome_proxy/webdriver/lofi.py

Issue 2717563002: Implement the LitePage Integration Test with ChromeDriver (Closed)
Patch Set: comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698