OLD | NEW |
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 from common import NotAndroid | 8 from common import NotAndroid |
9 | 9 |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 with TestDriver() as t: | 26 with TestDriver() as t: |
27 t.AddChromeArg('--enable-spdy-proxy-auth') | 27 t.AddChromeArg('--enable-spdy-proxy-auth') |
28 t.AddChromeArg('--enable-quic') | 28 t.AddChromeArg('--enable-quic') |
29 t.AddChromeArg('--data-reduction-proxy-http-proxies=https://proxy.googlezi
p.net:443') | 29 t.AddChromeArg('--data-reduction-proxy-http-proxies=https://proxy.googlezi
p.net:443') |
30 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') | 30 t.AddChromeArg('--force-fieldtrials=DataReductionProxyUseQuic/Enabled') |
31 t.LoadURL('http://check.googlezip.net/test.html') | 31 t.LoadURL('http://check.googlezip.net/test.html') |
32 responses = t.GetHTTPResponses() | 32 responses = t.GetHTTPResponses() |
33 self.assertEqual(2, len(responses)) | 33 self.assertEqual(2, len(responses)) |
34 for response in responses: | 34 for response in responses: |
35 self.assertHasChromeProxyViaHeader(response) | 35 self.assertHasChromeProxyViaHeader(response) |
| 36 |
| 37 # Ensure Chrome uses DataSaver in normal mode. |
| 38 def testCheckPageWithNormalMode(self): |
| 39 with TestDriver() as t: |
| 40 t.AddChromeArg('--enable-spdy-proxy-auth') |
| 41 t.LoadURL('http://check.googlezip.net/test.html') |
| 42 responses = t.GetHTTPResponses() |
| 43 self.assertNotEqual(0, len(responses)) |
| 44 for response in responses: |
| 45 self.assertHasChromeProxyViaHeader(response) |
36 | 46 |
37 # Ensure pageload metric pingback with DataSaver. | 47 # Ensure pageload metric pingback with DataSaver. |
38 def testPingback(self): | 48 def testPingback(self): |
39 with TestDriver() as t: | 49 with TestDriver() as t: |
40 t.AddChromeArg('--enable-spdy-proxy-auth') | 50 t.AddChromeArg('--enable-spdy-proxy-auth') |
41 t.AddChromeArg('--enable-data-reduction-proxy-force-pingback') | 51 t.AddChromeArg('--enable-data-reduction-proxy-force-pingback') |
42 t.LoadURL('http://check.googlezip.net/test.html') | 52 t.LoadURL('http://check.googlezip.net/test.html') |
43 t.LoadURL('http://check.googlezip.net/test.html') | 53 t.LoadURL('http://check.googlezip.net/test.html') |
44 t.SleepUntilHistogramHasEntry("DataReductionProxy.Pingback.Succeeded") | 54 t.SleepUntilHistogramHasEntry("DataReductionProxy.Pingback.Succeeded") |
45 # Verify one pingback attempt that was successful. | 55 # Verify one pingback attempt that was successful. |
46 attempted = t.GetHistogram('DataReductionProxy.Pingback.Attempted') | 56 attempted = t.GetHistogram('DataReductionProxy.Pingback.Attempted') |
47 self.assertEqual(1, attempted['count']) | 57 self.assertEqual(1, attempted['count']) |
48 succeeded = t.GetHistogram('DataReductionProxy.Pingback.Succeeded') | 58 succeeded = t.GetHistogram('DataReductionProxy.Pingback.Succeeded') |
49 self.assertEqual(1, succeeded['count']) | 59 self.assertEqual(1, succeeded['count']) |
50 | 60 |
51 if __name__ == '__main__': | 61 if __name__ == '__main__': |
52 IntegrationTest.RunAllTests() | 62 IntegrationTest.RunAllTests() |
OLD | NEW |