| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 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 | |
| 5 from measurements import blink_style | |
| 6 | |
| 7 from telemetry import decorators | |
| 8 from telemetry.testing import options_for_unittests | |
| 9 from telemetry.testing import page_test_test_case | |
| 10 | |
| 11 | |
| 12 class BlinkStyleTest(page_test_test_case.PageTestTestCase): | |
| 13 """Smoke test for Bink Style measurements. | |
| 14 | |
| 15 Runs BlinkStyle measurement on some simple pages and verifies | |
| 16 that expected metrics were added to the results. The test is purely | |
| 17 functional, i.e. it only checks if the metrics are present and non-zero. | |
| 18 """ | |
| 19 | |
| 20 def setUp(self): | |
| 21 self._options = options_for_unittests.GetCopy() | |
| 22 | |
| 23 @decorators.Disabled('chromeos') # crbug.com/483212 | |
| 24 def testForParsing(self): | |
| 25 ps = self.CreateStorySetFromFileInUnittestDataDir('blink_style.html') | |
| 26 measurement = blink_style.BlinkStyle() | |
| 27 results = self.RunMeasurement(measurement, ps, options=self._options) | |
| 28 self.assertEquals(0, len(results.failures)) | |
| 29 | |
| 30 def getMetric(results, name, count=1): | |
| 31 metrics = results.FindAllPageSpecificValuesNamed(name) | |
| 32 self.assertEquals(count, len(metrics)) | |
| 33 return metrics[0].value | |
| 34 | |
| 35 self.assertGreater(getMetric(results, 'parse_css_regular'), 0) | |
| 36 self.assertGreater(getMetric(results, 'tokenize_css_regular'), 0) | |
| 37 self.assertGreater(getMetric(results, 'update_style', 5), 0) | |
| 38 self.assertGreater(getMetric(results, 'update_style_cold', 5), 0) | |
| OLD | NEW |