| OLD | NEW |
| (Empty) |
| 1 # Copyright 2014 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 core import perf_benchmark | |
| 6 | |
| 7 from telemetry import benchmark | |
| 8 from telemetry.timeline import chrome_trace_category_filter | |
| 9 from telemetry.web_perf import timeline_based_measurement | |
| 10 | |
| 11 import page_sets | |
| 12 | |
| 13 TEXT_SELECTION_CATEGORY = 'blink' | |
| 14 TIMELINE_REQUIRED_CATEGORY = 'blink.console' | |
| 15 | |
| 16 | |
| 17 class _TextSelection(perf_benchmark.PerfBenchmark): | |
| 18 page_set = page_sets.TextSelectionSitesPageSet | |
| 19 | |
| 20 def CreateTimelineBasedMeasurementOptions(self): | |
| 21 cat_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() | |
| 22 cat_filter.AddIncludedCategory(TEXT_SELECTION_CATEGORY) | |
| 23 cat_filter.AddIncludedCategory(TIMELINE_REQUIRED_CATEGORY) | |
| 24 | |
| 25 return timeline_based_measurement.Options( | |
| 26 overhead_level=cat_filter) | |
| 27 | |
| 28 @classmethod | |
| 29 def Name(cls): | |
| 30 return 'text_selection' | |
| 31 | |
| 32 @classmethod | |
| 33 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 34 if 'text-selection' not in value.name: | |
| 35 return False | |
| 36 return value.values != None | |
| 37 | |
| 38 | |
| 39 # See crbug.com/519044 | |
| 40 @benchmark.Disabled('all') | |
| 41 @benchmark.Owner(emails=['mfomitchev@chromium.org']) | |
| 42 class TextSelectionDirection(_TextSelection): | |
| 43 """Measure text selection metrics while dragging a touch selection handle on a | |
| 44 subset of top ten mobile sites and using the 'direction' touch selection | |
| 45 strategy.""" | |
| 46 | |
| 47 def SetExtraBrowserOptions(self, options): | |
| 48 options.AppendExtraBrowserArgs(['--touch-selection-strategy=direction']) | |
| 49 | |
| 50 @classmethod | |
| 51 def Name(cls): | |
| 52 return 'text_selection.direction' | |
| 53 | |
| 54 | |
| 55 # See crbug.com/519044 | |
| 56 @benchmark.Disabled('all') | |
| 57 @benchmark.Owner(emails=['mfomitchev@chromium.org']) | |
| 58 class TextSelectionCharacter(_TextSelection): | |
| 59 """Measure text selection metrics while dragging a touch selection handle on a | |
| 60 subset of top ten mobile sites and using the 'character' touch selection | |
| 61 strategy.""" | |
| 62 | |
| 63 def SetExtraBrowserOptions(self, options): | |
| 64 options.AppendExtraBrowserArgs(['--touch-selection-strategy=character']) | |
| 65 | |
| 66 @classmethod | |
| 67 def Name(cls): | |
| 68 return 'text_selection.character' | |
| OLD | NEW |