| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 os | 5 import os |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from infra_libs import http_metrics | 8 from infra_libs.ts_mon.common import http_metrics |
| 9 from infra_libs import httplib2_utils | 9 from infra_libs import httplib2_utils |
| 10 | 10 |
| 11 import httplib2 | 11 import httplib2 |
| 12 import mock | 12 import mock |
| 13 import oauth2client.client | 13 import oauth2client.client |
| 14 | 14 |
| 15 | 15 |
| 16 DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') | 16 DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') |
| 17 | 17 |
| 18 | 18 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 self.http._request.return_value = ( | 193 self.http._request.return_value = ( |
| 194 httplib2.Response({'status': 200}), | 194 httplib2.Response({'status': 200}), |
| 195 'content') | 195 'content') |
| 196 | 196 |
| 197 _, _ = self.http.request('http://foo/') | 197 _, _ = self.http.request('http://foo/') |
| 198 self.assertEqual(1, http_metrics.durations.get( | 198 self.assertEqual(1, http_metrics.durations.get( |
| 199 {'name': 'test', 'client': 'httplib2'}).count) | 199 {'name': 'test', 'client': 'httplib2'}).count) |
| 200 self.assertAlmostEqual(300, http_metrics.durations.get( | 200 self.assertAlmostEqual(300, http_metrics.durations.get( |
| 201 {'name': 'test', 'client': 'httplib2'}).sum) | 201 {'name': 'test', 'client': 'httplib2'}).sum) |
| OLD | NEW |