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

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

Issue 2710193007: Implement the LoFi Integration Test with ChromeDriver (Closed)
Patch Set: use assertIn Created 3 years, 9 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
(Empty)
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
3 # found in the LICENSE file.
4
5 import common
6 from common import TestDriver
7 from common import IntegrationTest
8
9
10 class LoFi(IntegrationTest):
11
12 # Checks that the compressed image is below a certain threshold.
13 # The test page is uncacheable otherwise a cached page may be served that
14 # doesn't have the correct via headers.
15 def testLoFi(self):
16 with TestDriver() as test_driver:
17 test_driver.AddChromeArg('--enable-spdy-proxy-auth')
18 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on')
19 # Disable server experiments such as tamper detection.
20 test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-'
21 'disabled')
22 test_driver.AddChromeArg('--disable-quic')
23
24 test_driver.LoadURL('http://check.googlezip.net/static/index.html')
25
26 lofi_responses = 0
27 for response in test_driver.GetHTTPResponses():
28 if not response.url.endswith('png'):
29 continue
30 if not response.request_headers:
31 continue
32 self.assertHasChromeProxyViaHeader(response)
33 content_length = response.response_headers['content-length']
34 cpat_request = response.request_headers['chrome-proxy-accept-transform']
35 cpct_response = response.response_headers[
36 'chrome-proxy-content-transform']
37 if ('empty-image' in cpct_response):
38 lofi_responses = lofi_responses + 1
39 self.assertIn('empty-image', cpat_request)
40 self.assertTrue(int(content_length) < 100)
41
42 # Verify that Lo-Fi responses were seen.
43 self.assertNotEqual(0, lofi_responses)
44
45 if __name__ == '__main__':
46 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