Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: tools/chrome_proxy/common/chrome_proxy_metrics_unittest.py

Issue 1098253004: Move top_20 tests to a separate suite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ChromeProxyValidation in common in integration_tests Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import base64
6 import unittest
7
8 from common import chrome_proxy_metrics as metrics
9 from common import network_metrics_unittest as network_unittest
10
11
12 class ChromeProxyMetricTest(unittest.TestCase):
13
14 def testChromeProxyResponse(self):
15 # An https non-proxy response.
16 resp = metrics.ChromeProxyResponse(
17 network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
18 url='https://test.url',
19 response_headers={
20 'Content-Type': 'text/html',
21 'Content-Length': str(len(network_unittest.HTML_BODY)),
22 'Via': 'some other via',
23 },
24 body=network_unittest.HTML_BODY))
25 self.assertFalse(resp.ShouldHaveChromeProxyViaHeader())
26 self.assertFalse(resp.HasChromeProxyViaHeader())
27 self.assertTrue(resp.IsValidByViaHeader())
28
29 # A proxied JPEG image response
30 resp = metrics.ChromeProxyResponse(
31 network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
32 url='http://test.image',
33 response_headers={
34 'Content-Type': 'image/jpeg',
35 'Content-Encoding': 'gzip',
36 'Via': '1.1 ' + metrics.CHROME_PROXY_VIA_HEADER,
37 'X-Original-Content-Length': str(network_unittest.IMAGE_OCL),
38 },
39 body=base64.b64encode(network_unittest.IMAGE_BODY),
40 base64_encoded_body=True))
41 self.assertTrue(resp.ShouldHaveChromeProxyViaHeader())
42 self.assertTrue(resp.HasChromeProxyViaHeader())
43 self.assertTrue(resp.IsValidByViaHeader())
44
OLDNEW
« no previous file with comments | « tools/chrome_proxy/common/chrome_proxy_metrics.py ('k') | tools/chrome_proxy/common/network_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698