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

Side by Side Diff: tools/chrome_proxy/integration_tests/network_metrics_unittest.py

Issue 436453002: Remove page_measurement_results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 6 years, 4 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
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 network_metrics 8 from integration_tests import network_metrics
9 from metrics import test_page_measurement_results 9 from metrics import test_page_test_results
10 from telemetry.timeline import event 10 from telemetry.timeline import event
11 11
12 12
13 HTML_BODY = """<!DOCTYPE HTML> 13 HTML_BODY = """<!DOCTYPE HTML>
14 <html> 14 <html>
15 <head> </head> 15 <head> </head>
16 <body> 16 <body>
17 <div id="test"> TEST HTML</div> 17 <div id="test"> TEST HTML</div>
18 </body> 18 </body>
19 </html>""" 19 </html>"""
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 'X-Original-Content-Length': str(IMAGE_OCL), 152 'X-Original-Content-Length': str(IMAGE_OCL),
153 }, 153 },
154 body=base64.b64encode(IMAGE_BODY), 154 body=base64.b64encode(IMAGE_BODY),
155 base64_encoded_body=True), 155 base64_encoded_body=True),
156 ] 156 ]
157 metric = network_metrics.NetworkMetric() 157 metric = network_metrics.NetworkMetric()
158 metric._events = events 158 metric._events = events
159 metric.compute_data_saving = True 159 metric.compute_data_saving = True
160 160
161 self.assertTrue(len(events), len(list(metric.IterResponses(None)))) 161 self.assertTrue(len(events), len(list(metric.IterResponses(None))))
162 results = test_page_measurement_results.TestPageMeasurementResults(self) 162 results = test_page_test_results.TestPageTestResults(self)
163 metric.AddResults(None, results) 163 metric.AddResults(None, results)
164 164
165 cl = len(HTML_BODY) + GZIPPED_HTML_LEN + len(IMAGE_BODY) 165 cl = len(HTML_BODY) + GZIPPED_HTML_LEN + len(IMAGE_BODY)
166 results.AssertHasPageSpecificScalarValue('content_length', 'bytes', cl) 166 results.AssertHasPageSpecificScalarValue('content_length', 'bytes', cl)
167 167
168 ocl = len(HTML_BODY) + len(HTML_BODY) + IMAGE_OCL 168 ocl = len(HTML_BODY) + len(HTML_BODY) + IMAGE_OCL
169 results.AssertHasPageSpecificScalarValue( 169 results.AssertHasPageSpecificScalarValue(
170 'original_content_length', 'bytes', ocl) 170 'original_content_length', 'bytes', ocl)
171 171
172 saving_percent = float(ocl - cl) * 100/ ocl 172 saving_percent = float(ocl - cl) * 100/ ocl
173 results.AssertHasPageSpecificScalarValue( 173 results.AssertHasPageSpecificScalarValue(
174 'data_saving', 'percent', saving_percent) 174 'data_saving', 'percent', saving_percent)
OLDNEW
« no previous file with comments | « tools/chrome_proxy/integration_tests/chrome_proxy_metrics_unittest.py ('k') | tools/perf/measurements/page_cycler_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698