| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 from itertools import starmap | 5 from itertools import starmap |
| 6 from collections import defaultdict | 6 from collections import defaultdict |
| 7 | 7 |
| 8 from telemetry.core import util | 8 from telemetry.core import util |
| 9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
| 10 from telemetry.value import scalar | 10 from telemetry.value import scalar |
| 11 | 11 |
| 12 from measurements import timeline_controller | 12 from measurements import timeline_controller |
| 13 | 13 |
| 14 | 14 |
| 15 class BlinkStyle(page_test.PageTest): | 15 class BlinkStyle(page_test.PageTest): |
| 16 def __init__(self): | 16 def __init__(self): |
| 17 super(BlinkStyle, self).__init__() | 17 super(BlinkStyle, self).__init__() |
| 18 self._controller = None | 18 self._controller = None |
| 19 | 19 |
| 20 def WillNavigateToPage(self, page, tab): | 20 def WillNavigateToPage(self, page, tab): |
| 21 self._controller = timeline_controller.TimelineController() | 21 self._controller = timeline_controller.TimelineController() |
| 22 self._controller.trace_categories = 'blink,benchmark,blink.console' | 22 self._controller.trace_categories = 'blink_style,benchmark,blink.console' |
| 23 self._controller.SetUp(page, tab) | 23 self._controller.SetUp(page, tab) |
| 24 self._controller.Start(tab) | 24 self._controller.Start(tab) |
| 25 | 25 |
| 26 def CleanUpAfterPage(self, page, tab): | 26 def CleanUpAfterPage(self, page, tab): |
| 27 if self._controller: | 27 if self._controller: |
| 28 self._controller.CleanUp(tab) | 28 self._controller.CleanUp(tab) |
| 29 | 29 |
| 30 def ValidateAndMeasurePage(self, page, tab, results): | 30 def ValidateAndMeasurePage(self, page, tab, results): |
| 31 tab.WaitForDocumentReadyStateToBeComplete() | 31 tab.WaitForDocumentReadyStateToBeComplete() |
| 32 if not util.WaitFor(tab.HasReachedQuiescence, 30): | 32 if not util.WaitFor(tab.HasReachedQuiescence, 30): |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 tokens = sum(event.tokens for event in events) | 112 tokens = sum(event.tokens for event in events) |
| 113 length = sum(event.length for event in events) | 113 length = sum(event.length for event in events) |
| 114 | 114 |
| 115 results.AddValue( | 115 results.AddValue( |
| 116 scalar.ScalarValue(page, ('parse_css_%s' % category), | 116 scalar.ScalarValue(page, ('parse_css_%s' % category), |
| 117 'tokens/s', 1000 / (parse_duration / tokens))) | 117 'tokens/s', 1000 / (parse_duration / tokens))) |
| 118 | 118 |
| 119 results.AddValue( | 119 results.AddValue( |
| 120 scalar.ScalarValue(page, ('tokenize_css_%s' % category), | 120 scalar.ScalarValue(page, ('tokenize_css_%s' % category), |
| 121 'char/s', 1000 / (tokenize_duration / length))) | 121 'char/s', 1000 / (tokenize_duration / length))) |
| OLD | NEW |