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 base64 | 5 import base64 |
6 import unittest | 6 import unittest |
7 | 7 |
8 from integration_tests import chrome_proxy_metrics as metrics | 8 from common import chrome_proxy_metrics as metrics |
9 from integration_tests import network_metrics_unittest as network_unittest | 9 from common import network_metrics_unittest as network_unittest |
10 from telemetry.unittest_util import test_page_test_results | 10 from telemetry.unittest_util import test_page_test_results |
11 | 11 |
12 TEST_EXTRA_VIA_HEADER = '1.1 EXTRA_VIA_HEADER' | 12 TEST_EXTRA_VIA_HEADER = '1.1 EXTRA_VIA_HEADER' |
13 | 13 |
14 # Timeline events used in tests. | 14 # Timeline events used in tests. |
15 # An HTML not via proxy. | 15 # An HTML not via proxy. |
16 EVENT_HTML_DIRECT = network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( | 16 EVENT_HTML_DIRECT = network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( |
17 url='http://test.html1', | 17 url='http://test.html1', |
18 response_headers={ | 18 response_headers={ |
19 'Content-Type': 'text/html', | 19 'Content-Type': 'text/html', |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 self.assertTrue(exception_occurred) | 433 self.assertTrue(exception_occurred) |
434 | 434 |
435 # Passing in zero responses should cause a failure. | 435 # Passing in zero responses should cause a failure. |
436 metric.SetEvents([]) | 436 metric.SetEvents([]) |
437 no_responses_exception = False | 437 no_responses_exception = False |
438 try: | 438 try: |
439 metric.AddResultsForHTTPToDirectFallback(None, results, 'test.html2') | 439 metric.AddResultsForHTTPToDirectFallback(None, results, 'test.html2') |
440 except metrics.ChromeProxyMetricException: | 440 except metrics.ChromeProxyMetricException: |
441 no_responses_exception = True | 441 no_responses_exception = True |
442 self.assertTrue(no_responses_exception) | 442 self.assertTrue(no_responses_exception) |
OLD | NEW |