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 telemetry.core import wpr_modes | 7 from telemetry.core import wpr_modes |
8 from telemetry import decorators | 8 from telemetry import decorators |
9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
10 from telemetry.unittest_util import options_for_unittests | 10 from telemetry.unittest_util import options_for_unittests |
11 from telemetry.unittest_util import page_test_test_case | 11 from telemetry.unittest_util import page_test_test_case |
12 | 12 |
13 from measurements import rasterize_and_record_micro | 13 from measurements import rasterize_and_record_micro |
14 | 14 |
15 | 15 |
16 class RasterizeAndRecordMicroUnitTest(page_test_test_case.PageTestTestCase): | 16 class RasterizeAndRecordMicroUnitTest(page_test_test_case.PageTestTestCase): |
17 """Smoke test for rasterize_and_record_micro measurement | 17 """Smoke test for rasterize_and_record_micro measurement |
18 | 18 |
19 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 |
20 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, |
21 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. |
22 """ | 22 """ |
23 | 23 |
24 def setUp(self): | 24 def setUp(self): |
25 self._options = options_for_unittests.GetCopy() | 25 self._options = options_for_unittests.GetCopy() |
26 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF | 26 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF |
27 | 27 |
28 @decorators.Disabled('win', 'chromeos') | 28 @decorators.Disabled('win', 'chromeos') |
29 def testRasterizeAndRecordMicro(self): | 29 def testRasterizeAndRecordMicro(self): |
30 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') | 30 ps = self.CreateStorySetFromFileInUnittestDataDir('blank.html') |
31 measurement = rasterize_and_record_micro.RasterizeAndRecordMicro( | 31 measurement = rasterize_and_record_micro.RasterizeAndRecordMicro( |
32 rasterize_repeat=1, record_repeat=1, start_wait_time=0.0, | 32 rasterize_repeat=1, record_repeat=1, start_wait_time=0.0, |
33 report_detailed_results=True) | 33 report_detailed_results=True) |
34 try: | 34 try: |
35 results = self.RunMeasurement(measurement, ps, options=self._options) | 35 results = self.RunMeasurement(measurement, ps, options=self._options) |
36 except page_test.TestNotSupportedOnPlatformError as failure: | 36 except page_test.TestNotSupportedOnPlatformError as failure: |
37 logging.warning(str(failure)) | 37 logging.warning(str(failure)) |
38 return | 38 return |
39 self.assertEquals(0, len(results.failures)) | 39 self.assertEquals(0, len(results.failures)) |
40 | 40 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 self.assertEquals(len(viewport_picture_size), 1) | 96 self.assertEquals(len(viewport_picture_size), 1) |
97 self.assertGreater( | 97 self.assertGreater( |
98 viewport_picture_size[0].GetRepresentativeNumber(), 0) | 98 viewport_picture_size[0].GetRepresentativeNumber(), 0) |
99 | 99 |
100 total_size_of_pictures_in_piles = \ | 100 total_size_of_pictures_in_piles = \ |
101 results.FindAllPageSpecificValuesNamed( | 101 results.FindAllPageSpecificValuesNamed( |
102 'total_size_of_pictures_in_piles') | 102 'total_size_of_pictures_in_piles') |
103 self.assertEquals(len(total_size_of_pictures_in_piles), 1) | 103 self.assertEquals(len(total_size_of_pictures_in_piles), 1) |
104 self.assertGreater( | 104 self.assertGreater( |
105 total_size_of_pictures_in_piles[0].GetRepresentativeNumber(), 0) | 105 total_size_of_pictures_in_piles[0].GetRepresentativeNumber(), 0) |
OLD | NEW |