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
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
)
30 return 'text_selection'
33 def ValueCanBeAddedPredicate(cls
, value
, is_first_result
):
34 if 'text-selection' not in value
.name
:
36 return value
.values
!= None
39 # See crbug.com/519044
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
45 def SetExtraBrowserOptions(self
, options
):
46 options
.AppendExtraBrowserArgs(['--touch-selection-strategy=direction'])
50 return 'text_selection.direction'
53 # See crbug.com/519044
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
59 def SetExtraBrowserOptions(self
, options
):
60 options
.AppendExtraBrowserArgs(['--touch-selection-strategy=character'])
64 return 'text_selection.character'