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

Side by Side Diff: tools/chrome_proxy/webdriver/lofi.py

Issue 2717563002: Implement the LitePage Integration Test with ChromeDriver (Closed)
Patch Set: tbansal 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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 import common 5 import common
6 from common import TestDriver 6 from common import TestDriver
7 from common import IntegrationTest 7 from common import IntegrationTest
8 8
9 9
10 class LoFi(IntegrationTest): 10 class LoFi(IntegrationTest):
(...skipping 24 matching lines...) Expand all
35 cpct_response = response.response_headers[ 35 cpct_response = response.response_headers[
36 'chrome-proxy-content-transform'] 36 'chrome-proxy-content-transform']
37 if ('empty-image' in cpct_response): 37 if ('empty-image' in cpct_response):
38 lofi_responses = lofi_responses + 1 38 lofi_responses = lofi_responses + 1
39 self.assertTrue('empty-image' in cpat_request) 39 self.assertTrue('empty-image' in cpat_request)
40 self.assertTrue(int(content_length) < 100) 40 self.assertTrue(int(content_length) < 100)
41 41
42 # Verify that Lo-Fi responses were seen. 42 # Verify that Lo-Fi responses were seen.
43 self.assertNotEqual(0, lofi_responses) 43 self.assertNotEqual(0, lofi_responses)
44 44
45 # Checks that a Lite Page is served and that the ignore_preview_blacklist
46 # experiment is being used.
47 def testLitePage(self):
48 with TestDriver() as test_driver:
49 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
50 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on')
51 test_driver.AddChromeArg('--enable-data-reduction-proxy-lite-page')
52 test_driver.AddChromeArg('--disable-quic')
53
54 test_driver.LoadURL('http://check.googlezip.net/test.html')
55
56 lite_page_responses = 0
57 for response in test_driver.GetHTTPResponses():
58 if '/csi?' in response.url:
Robert Ogden 2017/02/23 23:47:48 Why is this needed? Maybe leave a comment.
megjablon 2017/02/23 23:58:18 Done.
59 continue
60 if response.url.startswith('data:'):
61 continue
62 chrome_proxy_request = response.request_headers['chrome-proxy']
63 cpat_request = response.request_headers['chrome-proxy-accept-transform']
64 cpct_response = response.response_headers[
65 'chrome-proxy-content-transform']
66 self.assertHasChromeProxyViaHeader(response)
67 self.assertTrue('exp=ignore_preview_blacklist' in
Robert Ogden 2017/02/23 23:47:48 Use assertIn https://docs.python.org/2/library/uni
megjablon 2017/02/23 23:58:18 Done.
68 chrome_proxy_request)
69 if ('lite-page' in cpct_response):
70 lite_page_responses = lite_page_responses + 1
71 self.assertTrue('lite-page' in cpat_request)
72
73 # Verify that a Lite Page response for the main frame was seen.
74 self.assertEqual(1, lite_page_responses)
75
45 if __name__ == '__main__': 76 if __name__ == '__main__':
46 IntegrationTest.RunAllTests() 77 IntegrationTest.RunAllTests()
OLDNEW
« 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