| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 datetime | 5 import datetime |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 from integration_tests import network_metrics | 9 from integration_tests import network_metrics |
| 10 from telemetry.page import page_test | 10 from telemetry.page import page_test |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 Otherwise, the return value will be (False, empty list). | 184 Otherwise, the return value will be (False, empty list). |
| 185 """ | 185 """ |
| 186 if not tab: | 186 if not tab: |
| 187 return False, [] | 187 return False, [] |
| 188 | 188 |
| 189 info = GetProxyInfoFromNetworkInternals(tab) | 189 info = GetProxyInfoFromNetworkInternals(tab) |
| 190 if not info['enabled']: | 190 if not info['enabled']: |
| 191 raise ChromeProxyMetricException, ( | 191 raise ChromeProxyMetricException, ( |
| 192 'Chrome proxy should be enabled. proxy info: %s' % info) | 192 'Chrome proxy should be enabled. proxy info: %s' % info) |
| 193 | 193 |
| 194 if not info['badProxies']: |
| 195 return False, [] |
| 196 |
| 194 bad_proxies = [str(p['proxy']) for p in info['badProxies']] | 197 bad_proxies = [str(p['proxy']) for p in info['badProxies']] |
| 195 bad_proxies.sort() | 198 bad_proxies.sort() |
| 196 proxies = [self.effective_proxies['proxy'], | 199 proxies = [self.effective_proxies['proxy'], |
| 197 self.effective_proxies['fallback']] | 200 self.effective_proxies['fallback']] |
| 198 proxies.sort() | 201 proxies.sort() |
| 199 proxies_dev = self.ProxyListForDev(proxies) | 202 proxies_dev = self.ProxyListForDev(proxies) |
| 200 proxies_dev.sort() | 203 proxies_dev.sort() |
| 201 if bad_proxies == proxies: | 204 if bad_proxies == proxies: |
| 202 return True, proxies | 205 return True, proxies |
| 203 elif bad_proxies == proxies_dev: | 206 elif bad_proxies == proxies_dev: |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 See the definition of VerifyBadProxies for details. | 451 See the definition of VerifyBadProxies for details. |
| 449 """ | 452 """ |
| 450 info = GetProxyInfoFromNetworkInternals(tab) | 453 info = GetProxyInfoFromNetworkInternals(tab) |
| 451 if not 'enabled' in info or not info['enabled']: | 454 if not 'enabled' in info or not info['enabled']: |
| 452 raise ChromeProxyMetricException, ( | 455 raise ChromeProxyMetricException, ( |
| 453 'Chrome proxy should be enabled. proxy info: %s' % info) | 456 'Chrome proxy should be enabled. proxy info: %s' % info) |
| 454 self.VerifyBadProxies(info['badProxies'], | 457 self.VerifyBadProxies(info['badProxies'], |
| 455 expected_bad_proxies) | 458 expected_bad_proxies) |
| 456 results.AddValue(scalar.ScalarValue( | 459 results.AddValue(scalar.ScalarValue( |
| 457 results.current_page, 'explicit_bypass', 'boolean', True)) | 460 results.current_page, 'explicit_bypass', 'boolean', True)) |
| OLD | NEW |