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 integration_tests import chrome_proxy_metrics as metrics |
9 from integration_tests import network_metrics_unittest as network_unittest | 9 from integration_tests import network_metrics_unittest as network_unittest |
10 from metrics import test_page_test_results | 10 from telemetry.unittest_util import test_page_test_results |
11 | 11 |
12 | 12 |
13 # Timeline events used in tests. | 13 # Timeline events used in tests. |
14 # An HTML not via proxy. | 14 # An HTML not via proxy. |
15 EVENT_HTML_DIRECT = network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( | 15 EVENT_HTML_DIRECT = network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( |
16 url='http://test.html1', | 16 url='http://test.html1', |
17 response_headers={ | 17 response_headers={ |
18 'Content-Type': 'text/html', | 18 'Content-Type': 'text/html', |
19 'Content-Length': str(len(network_unittest.HTML_BODY)), | 19 'Content-Length': str(len(network_unittest.HTML_BODY)), |
20 }, | 20 }, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 metric.SetEvents([EVENT_HTML_DIRECT, | 335 metric.SetEvents([EVENT_HTML_DIRECT, |
336 EVENT_HTML_DIRECT, | 336 EVENT_HTML_DIRECT, |
337 EVENT_IMAGE_DIRECT]) | 337 EVENT_IMAGE_DIRECT]) |
338 exception_occurred = False | 338 exception_occurred = False |
339 try: | 339 try: |
340 metric.AddResultsForHTTPToDirectFallback(None, results, 'test.html2') | 340 metric.AddResultsForHTTPToDirectFallback(None, results, 'test.html2') |
341 except metrics.ChromeProxyMetricException: | 341 except metrics.ChromeProxyMetricException: |
342 exception_occurred = True | 342 exception_occurred = True |
343 # The first response was expected through the HTTP fallback proxy. | 343 # The first response was expected through the HTTP fallback proxy. |
344 self.assertTrue(exception_occurred) | 344 self.assertTrue(exception_occurred) |
OLD | NEW |