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 import time | 6 import time |
7 from common import TestDriver | 7 from common import TestDriver |
8 from common import IntegrationTest | 8 from common import IntegrationTest |
9 from decorators import NotAndroid | 9 from decorators import NotAndroid |
10 | 10 |
11 | 11 |
12 class Smoke(IntegrationTest): | 12 class Smoke(IntegrationTest): |
13 | 13 |
| 14 # Checks that the "alternative" value is sent in the "exp" directive. |
| 15 def testAlternative(self): |
| 16 # If it was attempted to run with another experiment, skip this test. |
| 17 with TestDriver() as test_driver: |
| 18 test_driver.AddChromeArg('--enable-spdy-proxy-auth') |
| 19 test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on') |
| 20 test_driver.AddChromeArg('--enable-data-reduction-proxy-lite-page') |
| 21 test_driver.AddChromeArg( |
| 22 '--enable-features=DataReductionProxyAlternativeBackEnd') |
| 23 |
| 24 test_driver.LoadURL('http://check.googlezip.net/test.html') |
| 25 |
| 26 # Alternative does not represent a strict implementation, but must have |
| 27 # "exp=alternative". |
| 28 for response in test_driver.GetHTTPResponses(): |
| 29 self.assertHasChromeProxyViaHeader(response) |
| 30 self.assertEqual(200, response.status) |
| 31 if not common.ParseFlags().browser_args or ( |
| 32 '--data-reduction-proxy-experiment' not in |
| 33 common.ParseFlags().browser_args): |
| 34 self.assertIn('exp=alternative', |
| 35 response.request_headers['chrome-proxy']) |
| 36 |
14 # Ensure Chrome does not use DataSaver in Incognito mode. | 37 # Ensure Chrome does not use DataSaver in Incognito mode. |
15 # Clank does not honor the --incognito flag. | 38 # Clank does not honor the --incognito flag. |
16 @NotAndroid | 39 @NotAndroid |
17 def testCheckPageWithIncognito(self): | 40 def testCheckPageWithIncognito(self): |
18 with TestDriver() as t: | 41 with TestDriver() as t: |
19 t.AddChromeArg('--enable-spdy-proxy-auth') | 42 t.AddChromeArg('--enable-spdy-proxy-auth') |
20 t.AddChromeArg('--incognito') | 43 t.AddChromeArg('--incognito') |
21 t.LoadURL('http://check.googlezip.net/test.html') | 44 t.LoadURL('http://check.googlezip.net/test.html') |
22 for response in t.GetHTTPResponses(): | 45 for response in t.GetHTTPResponses(): |
23 self.assertNotHasChromeProxyViaHeader(response) | 46 self.assertNotHasChromeProxyViaHeader(response) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 t.LoadURL('http://check.googlezip.net/static') | 132 t.LoadURL('http://check.googlezip.net/static') |
110 # http://check.googlezip.net/static is a test page that has | 133 # http://check.googlezip.net/static is a test page that has |
111 # image/css/javascript resources. | 134 # image/css/javascript resources. |
112 responses = t.GetHTTPResponses() | 135 responses = t.GetHTTPResponses() |
113 self.assertNotEqual(0, len(responses)) | 136 self.assertNotEqual(0, len(responses)) |
114 for response in responses: | 137 for response in responses: |
115 self.assertHasChromeProxyViaHeader(response) | 138 self.assertHasChromeProxyViaHeader(response) |
116 | 139 |
117 if __name__ == '__main__': | 140 if __name__ == '__main__': |
118 IntegrationTest.RunAllTests() | 141 IntegrationTest.RunAllTests() |
OLD | NEW |