Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / tools / perf / benchmarks / text_selection.py
blob4720c4367c3db96a85b8241012dd65354d807e6f
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.
5 from core import perf_benchmark
7 from telemetry import benchmark
8 from telemetry.timeline import tracing_category_filter
9 from telemetry.web_perf import timeline_based_measurement
11 import page_sets
13 TEXT_SELECTION_CATEGORY = 'blink'
14 TIMELINE_REQUIRED_CATEGORY = 'blink.console'
17 class _TextSelection(perf_benchmark.PerfBenchmark):
18 page_set = page_sets.TextSelectionSitesPageSet
20 def CreateTimelineBasedMeasurementOptions(self):
21 cat_filter = tracing_category_filter.CreateMinimalOverheadFilter()
22 cat_filter.AddIncludedCategory(TEXT_SELECTION_CATEGORY)
23 cat_filter.AddIncludedCategory(TIMELINE_REQUIRED_CATEGORY)
25 return timeline_based_measurement.Options(
26 overhead_level=cat_filter)
28 @classmethod
29 def Name(cls):
30 return 'text_selection'
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
39 # See crbug.com/519044
40 @benchmark.Disabled()
41 class TextSelectionDirection(_TextSelection):
42 """Measure text selection metrics while dragging a touch selection handle on a
43 subset of top ten mobile sites and using the 'direction' touch selection
44 strategy."""
45 def SetExtraBrowserOptions(self, options):
46 options.AppendExtraBrowserArgs(['--touch-selection-strategy=direction'])
48 @classmethod
49 def Name(cls):
50 return 'text_selection.direction'
53 # See crbug.com/519044
54 @benchmark.Disabled()
55 class TextSelectionCharacter(_TextSelection):
56 """Measure text selection metrics while dragging a touch selection handle on a
57 subset of top ten mobile sites and using the 'character' touch selection
58 strategy."""
59 def SetExtraBrowserOptions(self, options):
60 options.AppendExtraBrowserArgs(['--touch-selection-strategy=character'])
62 @classmethod
63 def Name(cls):
64 return 'text_selection.character'