Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / tools / perf / measurements / rasterize_and_record_unittest.py
blob2bbe50c520f7cc5e127fa54cd2fe841fea2fabea
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
3 # found in the LICENSE file.
4 from measurements import rasterize_and_record
5 from telemetry.core import wpr_modes
6 from telemetry.page import page_measurement_unittest_base
7 from telemetry.unittest import DisabledTest, options_for_unittests
10 class RasterizeAndRecordUnitTest(
11 page_measurement_unittest_base.PageMeasurementUnitTestBase):
12 """Smoke test for rasterize_and_record measurement
14 Runs rasterize_and_record measurement on a simple page and verifies that
15 all metrics were added to the results. The test is purely functional,
16 i.e. it only checks if the metrics are present and non-zero.
17 """
19 def setUp(self):
20 self._options = options_for_unittests.GetCopy()
21 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
22 self._options.raster_record_repeat = 1
23 self._options.start_wait_time = 0.0
24 self._options.stop_wait_time = 2.0
26 @DisabledTest
27 def testRasterizeAndRecord(self):
28 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
29 measurement = rasterize_and_record.RasterizeAndRecord()
30 results = self.RunMeasurement(measurement, ps, options=self._options)
31 self.assertEquals(0, len(results.failures))
33 rasterize_time = results.FindAllPageSpecificValuesNamed('rasterize_time')
34 self.assertEquals(len(rasterize_time), 1)
35 self.assertGreater(rasterize_time[0].GetRepresentativeNumber(), 0)
37 record_time = results.FindAllPageSpecificValuesNamed('record_time')
38 self.assertEquals(len(record_time), 1)
39 self.assertGreater(record_time[0].GetRepresentativeNumber(), 0)
41 rasterized_pixels = results.FindAllPageSpecificValuesNamed(
42 'rasterized_pixels')
43 self.assertEquals(len(rasterized_pixels), 1)
44 self.assertGreater(rasterized_pixels[0].GetRepresentativeNumber(), 0)
46 recorded_pixels = results.FindAllPageSpecificValuesNamed('recorded_pixels')
47 self.assertEquals(len(recorded_pixels), 1)
48 self.assertGreater(recorded_pixels[0].GetRepresentativeNumber(), 0)