1# Copyright 2019 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.
4from page_sets.rendering import rendering_story
5from page_sets.rendering import story_tags
6from page_sets.system_health import platforms
7
8class ThroughputMetricStory(rendering_story.RenderingStory):
9  ABSTRACT_STORY = True
10  TAGS = [story_tags.THROUGHPUT_TEST]
11
12  def RunPageInteractions(self, action_runner):
13    with action_runner.CreateGestureInteraction('AnimationOnTap'):
14      action_runner.PressKey(' ')
15      action_runner.Wait(10)
16      action_runner.PressKey(' ')
17
18
19class MainZeroImplSixty(ThroughputMetricStory):
20  BASE_NAME = 'main_0fps_impl_60fps'
21  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
22  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
23         'main-impl-animations-throughput.html')
24
25
26class MainZeroImplSixtyNoUpdate(ThroughputMetricStory):
27  BASE_NAME = 'main_0fps_impl_60fps_no_update'
28  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
29  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
30         'main-impl-animations-no-update-throughput.html')
31
32
33class MainZeroImplSixtyNoUpdateJank(ThroughputMetricStory):
34  BASE_NAME = 'main_0fps_impl_60fps_no_update_jank'
35  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
36  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
37         'main-impl-animations-no-update-throughput.html?jank')
38
39
40class MainThirtyImplSixty(ThroughputMetricStory):
41  BASE_NAME = 'main_30fps_impl_60fps'
42  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
43  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
44         'main-impl-animations-throughput.html#30')
45  TAGS = ThroughputMetricStory.TAGS + [
46    story_tags.REPRESENTATIVE_MOBILE,
47    story_tags.REPRESENTATIVE_MAC_DESKTOP,
48    story_tags.REPRESENTATIVE_WIN_DESKTOP
49  ]
50
51
52class MainSixtyImplSixty(ThroughputMetricStory):
53  BASE_NAME = 'main_60fps_impl_60fps'
54  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
55  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
56         'main-impl-animations-throughput.html#60')
57
58
59class MainSixtyImplSixtyWithJankAndDelay(ThroughputMetricStory):
60  BASE_NAME = 'main_60fps_with_jank_and_delay_impl_60fps'
61  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
62  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
63         'main-impl-animations-throughput.html?jank&delay#60')
64
65
66class MainSixtyImplSixtyNoUpdate(ThroughputMetricStory):
67  BASE_NAME = 'main_60fps_impl_60fps_no_update'
68  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
69  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
70         'main-impl-animations-no-update-throughput.html#60')
71
72
73class MainSixtyImplSixtyNoUpdateJank(ThroughputMetricStory):
74  BASE_NAME = 'main_60fps_impl_60fps_no_update_jank'
75  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
76  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
77         'main-impl-animations-no-update-throughput.html?jank#60')
78
79
80class MainFifteenImplZero(ThroughputMetricStory):
81  BASE_NAME = 'main_15fps_impl_0fps'
82  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
83  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
84         'main-animations-throughput.html#15')
85
86
87class MainThirtyImplZero(ThroughputMetricStory):
88  BASE_NAME = 'main_30fps_impl_0fps'
89  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
90  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
91         'main-animations-throughput.html#30')
92
93
94class MainSixtyImplZero(ThroughputMetricStory):
95  BASE_NAME = 'main_60fps_impl_0fps'
96  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
97  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
98         'main-animations-throughput.html#60')
99
100
101class MainFifteenWithJankImplZero(ThroughputMetricStory):
102  BASE_NAME = 'main_15fps_with_jank_impl_0fps'
103  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
104  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
105         'main-animations-throughput.html?jank#15')
106
107
108class MainSixtyWithJankImplZero(ThroughputMetricStory):
109  BASE_NAME = 'main_60fps_with_jank_impl_0fps'
110  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
111  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
112         'main-animations-throughput.html?jank#60')
113
114
115class MainSixtyWithExtremeJankImplZero(ThroughputMetricStory):
116  BASE_NAME = 'main_60fps_with_extreme_jank_impl_0fps'
117  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
118  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
119         'main-animations-throughput.html?extremejank#60')
120
121
122class MainZeroWithJankImplZero(ThroughputMetricStory):
123  BASE_NAME = 'main_0fps_with_jank_impl_0fps'
124  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
125  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
126         'main-animations-throughput.html?jank#0')
127
128
129class OffScreenMainSixty(ThroughputMetricStory):
130  BASE_NAME = 'off_screen_main_60fps'
131  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
132  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
133         'main-animations-throughput.html?offscreen#60')
134
135
136class OffScreenMainSixtyJank(ThroughputMetricStory):
137  BASE_NAME = 'off_screen_main_60fps_jank'
138  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
139  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
140         'main-animations-throughput.html?jank&offscreen#60')
141
142
143class MainAnimationsHalfPresented(ThroughputMetricStory):
144  BASE_NAME = 'main_animations_half_presented'
145  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
146  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
147         'main-animations-half-presented.html')
148
149
150class ThroughputScrolling(ThroughputMetricStory):
151  ABSTRACT_STORY = True
152  URL = ('file://../../../../chrome/test/data/perf/throughput_test_cases/'
153         'throughput_scroll.html')
154  SPEED_IN_PIXELS_PER_SECOND = 5000
155  SELECTOR = 'undefined'
156
157  def RunPageInteractions(self, action_runner):
158    selector = self.SELECTOR
159    action_runner.WaitForElement(selector=selector)
160    with action_runner.CreateGestureInteraction('ScrollAction'):
161      action_runner.ScrollElement(selector=selector, direction='down')
162      action_runner.ScrollElement(selector=selector, direction='up')
163
164
165class ThroughputScrollingUncomposited(ThroughputScrolling):
166  BASE_NAME = 'throughput_scrolling_uncomposited'
167  SELECTOR = '.uncomposited'
168
169
170class ThroughputScrollingComposited(ThroughputScrolling):
171  BASE_NAME = 'throughput_scrolling_composited'
172  SELECTOR = '#composited'
173
174
175class ThroughputScrollingPassiveHandler(ThroughputScrolling):
176  BASE_NAME = 'throughput_scrolling_passive_handler'
177  SELECTOR = '#handler_passive'
178
179
180class ThroughputScrollingActiveHandler(ThroughputScrolling):
181  BASE_NAME = 'throughput_scrolling_active_handler'
182  SELECTOR = '#handler_active'
183