| 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 network_metrics | 8 from integration_tests import network_metrics |
| 9 from metrics import test_page_test_results | 9 from telemetry.unittest_util 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 cl = len(HTML_BODY) + GZIPPED_HTML_LEN + len(IMAGE_BODY) | 167 cl = len(HTML_BODY) + GZIPPED_HTML_LEN + len(IMAGE_BODY) |
| 168 results.AssertHasPageSpecificScalarValue('content_length', 'bytes', cl) | 168 results.AssertHasPageSpecificScalarValue('content_length', 'bytes', cl) |
| 169 | 169 |
| 170 ocl = len(HTML_BODY) + len(HTML_BODY) + IMAGE_OCL | 170 ocl = len(HTML_BODY) + len(HTML_BODY) + IMAGE_OCL |
| 171 results.AssertHasPageSpecificScalarValue( | 171 results.AssertHasPageSpecificScalarValue( |
| 172 'original_content_length', 'bytes', ocl) | 172 'original_content_length', 'bytes', ocl) |
| 173 | 173 |
| 174 saving_percent = float(ocl - cl) * 100/ ocl | 174 saving_percent = float(ocl - cl) * 100/ ocl |
| 175 results.AssertHasPageSpecificScalarValue( | 175 results.AssertHasPageSpecificScalarValue( |
| 176 'data_saving', 'percent', saving_percent) | 176 'data_saving', 'percent', saving_percent) |
| OLD | NEW |