| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 logging | 5 import logging |
| 6 | 6 |
| 7 from measurements import rasterize_and_record_micro | 7 from measurements import rasterize_and_record_micro |
| 8 from telemetry import test |
| 8 from telemetry.core import wpr_modes | 9 from telemetry.core import wpr_modes |
| 9 from telemetry.page import page_measurement_unittest_base | 10 from telemetry.page import page_measurement_unittest_base |
| 10 from telemetry.page import page_test | 11 from telemetry.page import page_test |
| 11 from telemetry.unittest import options_for_unittests | 12 from telemetry.unittest import options_for_unittests |
| 12 | 13 |
| 13 | 14 |
| 14 class RasterizeAndRecordMicroUnitTest( | 15 class RasterizeAndRecordMicroUnitTest( |
| 15 page_measurement_unittest_base.PageMeasurementUnitTestBase): | 16 page_measurement_unittest_base.PageMeasurementUnitTestBase): |
| 16 """Smoke test for rasterize_and_record_micro measurement | 17 """Smoke test for rasterize_and_record_micro measurement |
| 17 | 18 |
| 18 Runs rasterize_and_record_micro measurement on a simple page and verifies | 19 Runs rasterize_and_record_micro measurement on a simple page and verifies |
| 19 that all metrics were added to the results. The test is purely functional, | 20 that all metrics were added to the results. The test is purely functional, |
| 20 i.e. it only checks if the metrics are present and non-zero. | 21 i.e. it only checks if the metrics are present and non-zero. |
| 21 """ | 22 """ |
| 22 | 23 |
| 23 def setUp(self): | 24 def setUp(self): |
| 24 self._options = options_for_unittests.GetCopy() | 25 self._options = options_for_unittests.GetCopy() |
| 25 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF | 26 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF |
| 26 self._options.rasterize_repeat = 1 | 27 self._options.rasterize_repeat = 1 |
| 27 self._options.record_repeat = 1 | 28 self._options.record_repeat = 1 |
| 28 self._options.start_wait_time = 0.0 | 29 self._options.start_wait_time = 0.0 |
| 29 self._options.report_detailed_results = True | 30 self._options.report_detailed_results = True |
| 30 | 31 |
| 32 @test.Disabled('win') |
| 31 def testRasterizeAndRecordMicro(self): | 33 def testRasterizeAndRecordMicro(self): |
| 32 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') | 34 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') |
| 33 measurement = rasterize_and_record_micro.RasterizeAndRecordMicro() | 35 measurement = rasterize_and_record_micro.RasterizeAndRecordMicro() |
| 34 try: | 36 try: |
| 35 results = self.RunMeasurement(measurement, ps, options=self._options) | 37 results = self.RunMeasurement(measurement, ps, options=self._options) |
| 36 except page_test.TestNotSupportedOnPlatformFailure as failure: | 38 except page_test.TestNotSupportedOnPlatformFailure as failure: |
| 37 logging.warning(str(failure)) | 39 logging.warning(str(failure)) |
| 38 return | 40 return |
| 39 self.assertEquals(0, len(results.failures)) | 41 self.assertEquals(0, len(results.failures)) |
| 40 | 42 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 total_picture_layers_with_no_content[0].GetRepresentativeNumber(), 0) | 87 total_picture_layers_with_no_content[0].GetRepresentativeNumber(), 0) |
| 86 | 88 |
| 87 total_picture_layers_off_screen = \ | 89 total_picture_layers_off_screen = \ |
| 88 results.FindAllPageSpecificValuesNamed( | 90 results.FindAllPageSpecificValuesNamed( |
| 89 'total_picture_layers_off_screen') | 91 'total_picture_layers_off_screen') |
| 90 self.assertEquals(len(total_picture_layers_off_screen), 1) | 92 self.assertEquals(len(total_picture_layers_off_screen), 1) |
| 91 self.assertEqual( | 93 self.assertEqual( |
| 92 total_picture_layers_off_screen[0].GetRepresentativeNumber(), 0) | 94 total_picture_layers_off_screen[0].GetRepresentativeNumber(), 0) |
| 93 | 95 |
| 94 | 96 |
| OLD | NEW |