| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
| 5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
| 6 | 6 |
| 7 | 7 |
| 8 class KeySilkCasesPage(page_module.Page): | 8 class KeySilkCasesPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set): | 10 def __init__(self, url, page_set): |
| 11 super(KeySilkCasesPage, self).__init__( | 11 super(KeySilkCasesPage, self).__init__( |
| 12 url=url, page_set=page_set, credentials_path = 'data/credentials.json') | 12 url=url, page_set=page_set, credentials_path = 'data/credentials.json') |
| 13 self.user_agent_type = 'mobile' | 13 self.user_agent_type = 'mobile' |
| 14 self.archive_data_file = 'data/key_silk_cases.json' | 14 self.archive_data_file = 'data/key_silk_cases.json' |
| 15 | 15 |
| 16 def RunNavigateSteps(self, action_runner): | 16 def RunNavigateSteps(self, action_runner): |
| 17 action_runner.NavigateToPage(self) | 17 action_runner.NavigateToPage(self) |
| 18 action_runner.Wait(2) | 18 action_runner.Wait(2) |
| 19 | 19 |
| 20 def RunSmoothness(self, action_runner): | 20 def RunPageInteractions(self, action_runner): |
| 21 interaction = action_runner.BeginGestureInteraction( | 21 interaction = action_runner.BeginGestureInteraction( |
| 22 'ScrollAction', is_smooth=True) | 22 'ScrollAction', is_smooth=True) |
| 23 action_runner.ScrollPage() | 23 action_runner.ScrollPage() |
| 24 interaction.End() | 24 interaction.End() |
| 25 | 25 |
| 26 | 26 |
| 27 class Page1(KeySilkCasesPage): | 27 class Page1(KeySilkCasesPage): |
| 28 | 28 |
| 29 """ Why: Infinite scroll. Brings out all of our perf issues. """ | 29 """ Why: Infinite scroll. Brings out all of our perf issues. """ |
| 30 | 30 |
| 31 def __init__(self, page_set): | 31 def __init__(self, page_set): |
| 32 super(Page1, self).__init__( | 32 super(Page1, self).__init__( |
| 33 url='http://groupcloned.com/test/plain/list-recycle-transform.html', | 33 url='http://groupcloned.com/test/plain/list-recycle-transform.html', |
| 34 page_set=page_set) | 34 page_set=page_set) |
| 35 | 35 |
| 36 def RunSmoothness(self, action_runner): | 36 def RunPageInteractions(self, action_runner): |
| 37 interaction = action_runner.BeginGestureInteraction( | 37 interaction = action_runner.BeginGestureInteraction( |
| 38 'ScrollAction', is_smooth=True) | 38 'ScrollAction', is_smooth=True) |
| 39 action_runner.ScrollElement(selector='#scrollable') | 39 action_runner.ScrollElement(selector='#scrollable') |
| 40 interaction.End() | 40 interaction.End() |
| 41 | 41 |
| 42 | 42 |
| 43 class Page2(KeySilkCasesPage): | 43 class Page2(KeySilkCasesPage): |
| 44 | 44 |
| 45 """ Why: Brings out layer management bottlenecks. """ | 45 """ Why: Brings out layer management bottlenecks. """ |
| 46 | 46 |
| 47 def __init__(self, page_set): | 47 def __init__(self, page_set): |
| 48 super(Page2, self).__init__( | 48 super(Page2, self).__init__( |
| 49 url='http://groupcloned.com/test/plain/list-animation-simple.html', | 49 url='http://groupcloned.com/test/plain/list-animation-simple.html', |
| 50 page_set=page_set) | 50 page_set=page_set) |
| 51 | 51 |
| 52 def RunSmoothness(self, action_runner): | 52 def RunPageInteractions(self, action_runner): |
| 53 action_runner.Wait(2) | 53 action_runner.Wait(2) |
| 54 | 54 |
| 55 | 55 |
| 56 class Page3(KeySilkCasesPage): | 56 class Page3(KeySilkCasesPage): |
| 57 | 57 |
| 58 """ | 58 """ |
| 59 Why: Best-known method for fake sticky. Janks sometimes. Interacts badly with | 59 Why: Best-known method for fake sticky. Janks sometimes. Interacts badly with |
| 60 compositor scrolls. | 60 compositor scrolls. |
| 61 """ | 61 """ |
| 62 | 62 |
| 63 def __init__(self, page_set): | 63 def __init__(self, page_set): |
| 64 super(Page3, self).__init__( | 64 super(Page3, self).__init__( |
| 65 # pylint: disable=C0301 | 65 # pylint: disable=C0301 |
| 66 url='http://groupcloned.com/test/plain/sticky-using-webkit-backface-visibi
lity.html', | 66 url='http://groupcloned.com/test/plain/sticky-using-webkit-backface-visibi
lity.html', |
| 67 page_set=page_set) | 67 page_set=page_set) |
| 68 | 68 |
| 69 def RunSmoothness(self, action_runner): | 69 def RunPageInteractions(self, action_runner): |
| 70 interaction = action_runner.BeginGestureInteraction( | 70 interaction = action_runner.BeginGestureInteraction( |
| 71 'ScrollAction', is_smooth=True) | 71 'ScrollAction', is_smooth=True) |
| 72 action_runner.ScrollElement(selector='#container') | 72 action_runner.ScrollElement(selector='#container') |
| 73 interaction.End() | 73 interaction.End() |
| 74 | 74 |
| 75 | 75 |
| 76 class Page4(KeySilkCasesPage): | 76 class Page4(KeySilkCasesPage): |
| 77 | 77 |
| 78 """ | 78 """ |
| 79 Why: Card expansion: only the card should repaint, but in reality lots of | 79 Why: Card expansion: only the card should repaint, but in reality lots of |
| 80 storms happen. | 80 storms happen. |
| 81 """ | 81 """ |
| 82 | 82 |
| 83 def __init__(self, page_set): | 83 def __init__(self, page_set): |
| 84 super(Page4, self).__init__( | 84 super(Page4, self).__init__( |
| 85 url='http://jsfiddle.net/3yDKh/15/show/', | 85 url='http://jsfiddle.net/3yDKh/15/show/', |
| 86 page_set=page_set) | 86 page_set=page_set) |
| 87 | 87 |
| 88 def RunSmoothness(self, action_runner): | 88 def RunPageInteractions(self, action_runner): |
| 89 action_runner.Wait(3) | 89 action_runner.Wait(3) |
| 90 | 90 |
| 91 | 91 |
| 92 class Page5(KeySilkCasesPage): | 92 class Page5(KeySilkCasesPage): |
| 93 | 93 |
| 94 """ | 94 """ |
| 95 Why: Card expansion with animated contents, using will-change on the card | 95 Why: Card expansion with animated contents, using will-change on the card |
| 96 """ | 96 """ |
| 97 | 97 |
| 98 def __init__(self, page_set): | 98 def __init__(self, page_set): |
| 99 super(Page5, self).__init__( | 99 super(Page5, self).__init__( |
| 100 url='http://jsfiddle.net/jx5De/14/show/', | 100 url='http://jsfiddle.net/jx5De/14/show/', |
| 101 page_set=page_set) | 101 page_set=page_set) |
| 102 | 102 |
| 103 self.gpu_raster = True | 103 self.gpu_raster = True |
| 104 | 104 |
| 105 def RunSmoothness(self, action_runner): | 105 def RunPageInteractions(self, action_runner): |
| 106 action_runner.Wait(4) | 106 action_runner.Wait(4) |
| 107 | 107 |
| 108 | 108 |
| 109 class Page6(KeySilkCasesPage): | 109 class Page6(KeySilkCasesPage): |
| 110 | 110 |
| 111 """ | 111 """ |
| 112 Why: Card fly-in: It should be fast to animate in a bunch of cards using | 112 Why: Card fly-in: It should be fast to animate in a bunch of cards using |
| 113 margin-top and letting layout do the rest. | 113 margin-top and letting layout do the rest. |
| 114 """ | 114 """ |
| 115 | 115 |
| 116 def __init__(self, page_set): | 116 def __init__(self, page_set): |
| 117 super(Page6, self).__init__( | 117 super(Page6, self).__init__( |
| 118 url='http://jsfiddle.net/3yDKh/16/show/', | 118 url='http://jsfiddle.net/3yDKh/16/show/', |
| 119 page_set=page_set) | 119 page_set=page_set) |
| 120 | 120 |
| 121 def RunSmoothness(self, action_runner): | 121 def RunPageInteractions(self, action_runner): |
| 122 action_runner.Wait(3) | 122 action_runner.Wait(3) |
| 123 | 123 |
| 124 | 124 |
| 125 class Page7(KeySilkCasesPage): | 125 class Page7(KeySilkCasesPage): |
| 126 | 126 |
| 127 """ | 127 """ |
| 128 Why: Image search expands a spacer div when you click an image to accomplish | 128 Why: Image search expands a spacer div when you click an image to accomplish |
| 129 a zoomin effect. Each image has a layer. Even so, this triggers a lot of | 129 a zoomin effect. Each image has a layer. Even so, this triggers a lot of |
| 130 unnecessary repainting. | 130 unnecessary repainting. |
| 131 """ | 131 """ |
| 132 | 132 |
| 133 def __init__(self, page_set): | 133 def __init__(self, page_set): |
| 134 super(Page7, self).__init__( | 134 super(Page7, self).__init__( |
| 135 url='http://jsfiddle.net/R8DX9/4/show/', | 135 url='http://jsfiddle.net/R8DX9/4/show/', |
| 136 page_set=page_set) | 136 page_set=page_set) |
| 137 | 137 |
| 138 def RunSmoothness(self, action_runner): | 138 def RunPageInteractions(self, action_runner): |
| 139 action_runner.Wait(3) | 139 action_runner.Wait(3) |
| 140 | 140 |
| 141 | 141 |
| 142 class Page8(KeySilkCasesPage): | 142 class Page8(KeySilkCasesPage): |
| 143 | 143 |
| 144 """ | 144 """ |
| 145 Why: Swipe to dismiss of an element that has a fixed-position child that is | 145 Why: Swipe to dismiss of an element that has a fixed-position child that is |
| 146 its pseudo-sticky header. Brings out issues with layer creation and | 146 its pseudo-sticky header. Brings out issues with layer creation and |
| 147 repainting. | 147 repainting. |
| 148 """ | 148 """ |
| 149 | 149 |
| 150 def __init__(self, page_set): | 150 def __init__(self, page_set): |
| 151 super(Page8, self).__init__( | 151 super(Page8, self).__init__( |
| 152 url='http://jsfiddle.net/rF9Gh/7/show/', | 152 url='http://jsfiddle.net/rF9Gh/7/show/', |
| 153 page_set=page_set) | 153 page_set=page_set) |
| 154 | 154 |
| 155 def RunSmoothness(self, action_runner): | 155 def RunPageInteractions(self, action_runner): |
| 156 action_runner.Wait(3) | 156 action_runner.Wait(3) |
| 157 | 157 |
| 158 | 158 |
| 159 class Page9(KeySilkCasesPage): | 159 class Page9(KeySilkCasesPage): |
| 160 | 160 |
| 161 """ | 161 """ |
| 162 Why: Horizontal and vertical expansion of a card that is cheap to layout but | 162 Why: Horizontal and vertical expansion of a card that is cheap to layout but |
| 163 costly to rasterize. | 163 costly to rasterize. |
| 164 """ | 164 """ |
| 165 | 165 |
| 166 def __init__(self, page_set): | 166 def __init__(self, page_set): |
| 167 super(Page9, self).__init__( | 167 super(Page9, self).__init__( |
| 168 url='http://jsfiddle.net/TLXLu/3/show/', | 168 url='http://jsfiddle.net/TLXLu/3/show/', |
| 169 page_set=page_set) | 169 page_set=page_set) |
| 170 | 170 |
| 171 self.gpu_raster = True | 171 self.gpu_raster = True |
| 172 | 172 |
| 173 def RunSmoothness(self, action_runner): | 173 def RunPageInteractions(self, action_runner): |
| 174 action_runner.Wait(4) | 174 action_runner.Wait(4) |
| 175 | 175 |
| 176 | 176 |
| 177 class Page10(KeySilkCasesPage): | 177 class Page10(KeySilkCasesPage): |
| 178 | 178 |
| 179 """ | 179 """ |
| 180 Why: Vertical Expansion of a card that is cheap to layout but costly to | 180 Why: Vertical Expansion of a card that is cheap to layout but costly to |
| 181 rasterize. | 181 rasterize. |
| 182 """ | 182 """ |
| 183 | 183 |
| 184 def __init__(self, page_set): | 184 def __init__(self, page_set): |
| 185 super(Page10, self).__init__( | 185 super(Page10, self).__init__( |
| 186 url='http://jsfiddle.net/cKB9D/7/show/', | 186 url='http://jsfiddle.net/cKB9D/7/show/', |
| 187 page_set=page_set) | 187 page_set=page_set) |
| 188 | 188 |
| 189 self.gpu_raster = True | 189 self.gpu_raster = True |
| 190 | 190 |
| 191 def RunSmoothness(self, action_runner): | 191 def RunPageInteractions(self, action_runner): |
| 192 action_runner.Wait(4) | 192 action_runner.Wait(4) |
| 193 | 193 |
| 194 | 194 |
| 195 class Page11(KeySilkCasesPage): | 195 class Page11(KeySilkCasesPage): |
| 196 | 196 |
| 197 """ | 197 """ |
| 198 Why: Parallax effect is common on photo-viewer-like applications, overloading | 198 Why: Parallax effect is common on photo-viewer-like applications, overloading |
| 199 software rasterization | 199 software rasterization |
| 200 """ | 200 """ |
| 201 | 201 |
| 202 def __init__(self, page_set): | 202 def __init__(self, page_set): |
| 203 super(Page11, self).__init__( | 203 super(Page11, self).__init__( |
| 204 url='http://jsfiddle.net/vBQHH/11/show/', | 204 url='http://jsfiddle.net/vBQHH/11/show/', |
| 205 page_set=page_set) | 205 page_set=page_set) |
| 206 | 206 |
| 207 self.gpu_raster = True | 207 self.gpu_raster = True |
| 208 | 208 |
| 209 def RunSmoothness(self, action_runner): | 209 def RunPageInteractions(self, action_runner): |
| 210 action_runner.Wait(4) | 210 action_runner.Wait(4) |
| 211 | 211 |
| 212 | 212 |
| 213 class Page12(KeySilkCasesPage): | 213 class Page12(KeySilkCasesPage): |
| 214 | 214 |
| 215 """ Why: Addressing paint storms during coordinated animations. """ | 215 """ Why: Addressing paint storms during coordinated animations. """ |
| 216 | 216 |
| 217 def __init__(self, page_set): | 217 def __init__(self, page_set): |
| 218 super(Page12, self).__init__( | 218 super(Page12, self).__init__( |
| 219 url='http://jsfiddle.net/ugkd4/10/show/', | 219 url='http://jsfiddle.net/ugkd4/10/show/', |
| 220 page_set=page_set) | 220 page_set=page_set) |
| 221 | 221 |
| 222 def RunSmoothness(self, action_runner): | 222 def RunPageInteractions(self, action_runner): |
| 223 action_runner.Wait(5) | 223 action_runner.Wait(5) |
| 224 | 224 |
| 225 | 225 |
| 226 class Page13(KeySilkCasesPage): | 226 class Page13(KeySilkCasesPage): |
| 227 | 227 |
| 228 """ Why: Mask transitions are common mobile use cases. """ | 228 """ Why: Mask transitions are common mobile use cases. """ |
| 229 | 229 |
| 230 def __init__(self, page_set): | 230 def __init__(self, page_set): |
| 231 super(Page13, self).__init__( | 231 super(Page13, self).__init__( |
| 232 url='http://jsfiddle.net/xLuvC/1/show/', | 232 url='http://jsfiddle.net/xLuvC/1/show/', |
| 233 page_set=page_set) | 233 page_set=page_set) |
| 234 | 234 |
| 235 self.gpu_raster = True | 235 self.gpu_raster = True |
| 236 | 236 |
| 237 def RunSmoothness(self, action_runner): | 237 def RunPageInteractions(self, action_runner): |
| 238 action_runner.Wait(4) | 238 action_runner.Wait(4) |
| 239 | 239 |
| 240 | 240 |
| 241 class Page14(KeySilkCasesPage): | 241 class Page14(KeySilkCasesPage): |
| 242 | 242 |
| 243 """ Why: Card expansions with images and text are pretty and common. """ | 243 """ Why: Card expansions with images and text are pretty and common. """ |
| 244 | 244 |
| 245 def __init__(self, page_set): | 245 def __init__(self, page_set): |
| 246 super(Page14, self).__init__( | 246 super(Page14, self).__init__( |
| 247 url='http://jsfiddle.net/bNp2h/3/show/', | 247 url='http://jsfiddle.net/bNp2h/3/show/', |
| 248 page_set=page_set) | 248 page_set=page_set) |
| 249 | 249 |
| 250 self.gpu_raster = True | 250 self.gpu_raster = True |
| 251 | 251 |
| 252 def RunSmoothness(self, action_runner): | 252 def RunPageInteractions(self, action_runner): |
| 253 action_runner.Wait(4) | 253 action_runner.Wait(4) |
| 254 | 254 |
| 255 | 255 |
| 256 class Page15(KeySilkCasesPage): | 256 class Page15(KeySilkCasesPage): |
| 257 | 257 |
| 258 """ Why: Coordinated animations for expanding elements. """ | 258 """ Why: Coordinated animations for expanding elements. """ |
| 259 | 259 |
| 260 def __init__(self, page_set): | 260 def __init__(self, page_set): |
| 261 super(Page15, self).__init__( | 261 super(Page15, self).__init__( |
| 262 url='file://key_silk_cases/font_wipe.html', | 262 url='file://key_silk_cases/font_wipe.html', |
| 263 page_set=page_set) | 263 page_set=page_set) |
| 264 | 264 |
| 265 def RunSmoothness(self, action_runner): | 265 def RunPageInteractions(self, action_runner): |
| 266 action_runner.Wait(5) | 266 action_runner.Wait(5) |
| 267 | 267 |
| 268 | 268 |
| 269 class Page16(KeySilkCasesPage): | 269 class Page16(KeySilkCasesPage): |
| 270 | 270 |
| 271 def __init__(self, page_set): | 271 def __init__(self, page_set): |
| 272 super(Page16, self).__init__( | 272 super(Page16, self).__init__( |
| 273 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', | 273 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', |
| 274 page_set=page_set) | 274 page_set=page_set) |
| 275 | 275 |
| 276 def RunNavigateSteps(self, action_runner): | 276 def RunNavigateSteps(self, action_runner): |
| 277 action_runner.NavigateToPage(self) | 277 action_runner.NavigateToPage(self) |
| 278 action_runner.Wait(2) | 278 action_runner.Wait(2) |
| 279 | 279 |
| 280 def SwipeToDismiss(self, action_runner): | 280 def SwipeToDismiss(self, action_runner): |
| 281 interaction = action_runner.BeginGestureInteraction( | 281 interaction = action_runner.BeginGestureInteraction( |
| 282 'SwipeAction', is_smooth=True) | 282 'SwipeAction', is_smooth=True) |
| 283 action_runner.SwipeElement( | 283 action_runner.SwipeElement( |
| 284 left_start_ratio=0.8, top_start_ratio=0.2, | 284 left_start_ratio=0.8, top_start_ratio=0.2, |
| 285 direction='left', distance=400, speed_in_pixels_per_second=5000, | 285 direction='left', distance=400, speed_in_pixels_per_second=5000, |
| 286 element_function='document.getElementsByClassName("message")[2]') | 286 element_function='document.getElementsByClassName("message")[2]') |
| 287 interaction.End() | 287 interaction.End() |
| 288 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 288 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
| 289 action_runner.WaitForJavaScriptCondition( | 289 action_runner.WaitForJavaScriptCondition( |
| 290 'document.getElementsByClassName("message").length < 18') | 290 'document.getElementsByClassName("message").length < 18') |
| 291 interaction.End() | 291 interaction.End() |
| 292 | 292 |
| 293 def RunSmoothness(self, action_runner): | 293 def RunPageInteractions(self, action_runner): |
| 294 self.SwipeToDismiss(action_runner) | 294 self.SwipeToDismiss(action_runner) |
| 295 | 295 |
| 296 | 296 |
| 297 class Page17(KeySilkCasesPage): | 297 class Page17(KeySilkCasesPage): |
| 298 | 298 |
| 299 def __init__(self, page_set): | 299 def __init__(self, page_set): |
| 300 super(Page17, self).__init__( | 300 super(Page17, self).__init__( |
| 301 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', | 301 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', |
| 302 page_set=page_set) | 302 page_set=page_set) |
| 303 | 303 |
| 304 def RunNavigateSteps(self, action_runner): | 304 def RunNavigateSteps(self, action_runner): |
| 305 action_runner.NavigateToPage(self) | 305 action_runner.NavigateToPage(self) |
| 306 action_runner.Wait(2) | 306 action_runner.Wait(2) |
| 307 | 307 |
| 308 def RunSmoothness(self, action_runner): | 308 def RunPageInteractions(self, action_runner): |
| 309 self.StressHideyBars(action_runner) | 309 self.StressHideyBars(action_runner) |
| 310 | 310 |
| 311 def StressHideyBars(self, action_runner): | 311 def StressHideyBars(self, action_runner): |
| 312 interaction = action_runner.BeginGestureInteraction( | 312 interaction = action_runner.BeginGestureInteraction( |
| 313 'ScrollAction', is_smooth=True) | 313 'ScrollAction', is_smooth=True) |
| 314 action_runner.ScrollElement( | 314 action_runner.ScrollElement( |
| 315 selector='#messages', direction='down', speed_in_pixels_per_second=200) | 315 selector='#messages', direction='down', speed_in_pixels_per_second=200) |
| 316 interaction.End() | 316 interaction.End() |
| 317 interaction = action_runner.BeginGestureInteraction( | 317 interaction = action_runner.BeginGestureInteraction( |
| 318 'ScrollAction', is_smooth=True) | 318 'ScrollAction', is_smooth=True) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 330 | 330 |
| 331 def __init__(self, page_set): | 331 def __init__(self, page_set): |
| 332 super(Page18, self).__init__( | 332 super(Page18, self).__init__( |
| 333 url='file://key_silk_cases/inbox_app.html?toggle_drawer', | 333 url='file://key_silk_cases/inbox_app.html?toggle_drawer', |
| 334 page_set=page_set) | 334 page_set=page_set) |
| 335 | 335 |
| 336 def RunNavigateSteps(self, action_runner): | 336 def RunNavigateSteps(self, action_runner): |
| 337 action_runner.NavigateToPage(self) | 337 action_runner.NavigateToPage(self) |
| 338 action_runner.Wait(2) | 338 action_runner.Wait(2) |
| 339 | 339 |
| 340 def RunSmoothness(self, action_runner): | 340 def RunPageInteractions(self, action_runner): |
| 341 for _ in xrange(6): | 341 for _ in xrange(6): |
| 342 self.ToggleDrawer(action_runner) | 342 self.ToggleDrawer(action_runner) |
| 343 | 343 |
| 344 def ToggleDrawer(self, action_runner): | 344 def ToggleDrawer(self, action_runner): |
| 345 interaction = action_runner.BeginInteraction( | 345 interaction = action_runner.BeginInteraction( |
| 346 'Action_TapAction', is_smooth=True) | 346 'Action_TapAction', is_smooth=True) |
| 347 action_runner.TapElement('#menu-button') | 347 action_runner.TapElement('#menu-button') |
| 348 action_runner.Wait(1) | 348 action_runner.Wait(1) |
| 349 interaction.End() | 349 interaction.End() |
| 350 | 350 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 document.getElementById("nav-drawer").active && | 367 document.getElementById("nav-drawer").active && |
| 368 document.getElementById("nav-drawer").children[0] | 368 document.getElementById("nav-drawer").children[0] |
| 369 .getBoundingClientRect().left == 0''') | 369 .getBoundingClientRect().left == 0''') |
| 370 interaction.End() | 370 interaction.End() |
| 371 | 371 |
| 372 def RunNavigateSteps(self, action_runner): | 372 def RunNavigateSteps(self, action_runner): |
| 373 action_runner.NavigateToPage(self) | 373 action_runner.NavigateToPage(self) |
| 374 action_runner.Wait(2) | 374 action_runner.Wait(2) |
| 375 self.ToggleDrawer(action_runner) | 375 self.ToggleDrawer(action_runner) |
| 376 | 376 |
| 377 def RunSmoothness(self, action_runner): | 377 def RunPageInteractions(self, action_runner): |
| 378 self.SlideDrawer(action_runner) | 378 self.SlideDrawer(action_runner) |
| 379 | 379 |
| 380 def SlideDrawer(self, action_runner): | 380 def SlideDrawer(self, action_runner): |
| 381 interaction = action_runner.BeginInteraction( | 381 interaction = action_runner.BeginInteraction( |
| 382 'Action_SwipeAction', is_smooth=True) | 382 'Action_SwipeAction', is_smooth=True) |
| 383 action_runner.SwipeElement( | 383 action_runner.SwipeElement( |
| 384 left_start_ratio=0.8, top_start_ratio=0.2, | 384 left_start_ratio=0.8, top_start_ratio=0.2, |
| 385 direction='left', distance=200, | 385 direction='left', distance=200, |
| 386 element_function='document.getElementById("nav-drawer").children[0]') | 386 element_function='document.getElementById("nav-drawer").children[0]') |
| 387 action_runner.WaitForJavaScriptCondition( | 387 action_runner.WaitForJavaScriptCondition( |
| 388 '!document.getElementById("nav-drawer").active') | 388 '!document.getElementById("nav-drawer").active') |
| 389 interaction.End() | 389 interaction.End() |
| 390 | 390 |
| 391 | 391 |
| 392 class Page20(KeySilkCasesPage): | 392 class Page20(KeySilkCasesPage): |
| 393 | 393 |
| 394 """ Why: Shadow DOM infinite scrolling. """ | 394 """ Why: Shadow DOM infinite scrolling. """ |
| 395 | 395 |
| 396 def __init__(self, page_set): | 396 def __init__(self, page_set): |
| 397 super(Page20, self).__init__( | 397 super(Page20, self).__init__( |
| 398 url='file://key_silk_cases/infinite_scrolling.html', | 398 url='file://key_silk_cases/infinite_scrolling.html', |
| 399 page_set=page_set) | 399 page_set=page_set) |
| 400 | 400 |
| 401 def RunSmoothness(self, action_runner): | 401 def RunPageInteractions(self, action_runner): |
| 402 interaction = action_runner.BeginGestureInteraction( | 402 interaction = action_runner.BeginGestureInteraction( |
| 403 'ScrollAction', is_smooth=True) | 403 'ScrollAction', is_smooth=True) |
| 404 action_runner.ScrollElement( | 404 action_runner.ScrollElement( |
| 405 selector='#container', speed_in_pixels_per_second=5000) | 405 selector='#container', speed_in_pixels_per_second=5000) |
| 406 interaction.End() | 406 interaction.End() |
| 407 | 407 |
| 408 | 408 |
| 409 class GwsExpansionPage(KeySilkCasesPage): | 409 class GwsExpansionPage(KeySilkCasesPage): |
| 410 """Abstract base class for pages that expand Google knowledge panels.""" | 410 """Abstract base class for pages that expand Google knowledge panels.""" |
| 411 | 411 |
| 412 def NavigateWait(self, action_runner): | 412 def NavigateWait(self, action_runner): |
| 413 action_runner.NavigateToPage(self) | 413 action_runner.NavigateToPage(self) |
| 414 action_runner.Wait(3) | 414 action_runner.Wait(3) |
| 415 | 415 |
| 416 def ExpandKnowledgeCard(self, action_runner): | 416 def ExpandKnowledgeCard(self, action_runner): |
| 417 # expand card | 417 # expand card |
| 418 interaction = action_runner.BeginInteraction( | 418 interaction = action_runner.BeginInteraction( |
| 419 'Action_TapAction', is_smooth=True) | 419 'Action_TapAction', is_smooth=True) |
| 420 action_runner.TapElement( | 420 action_runner.TapElement( |
| 421 element_function='document.getElementsByClassName("vk_arc")[0]') | 421 element_function='document.getElementsByClassName("vk_arc")[0]') |
| 422 action_runner.Wait(2) | 422 action_runner.Wait(2) |
| 423 interaction.End() | 423 interaction.End() |
| 424 | 424 |
| 425 def ScrollKnowledgeCardToTop(self, action_runner, card_id): | 425 def ScrollKnowledgeCardToTop(self, action_runner, card_id): |
| 426 # scroll until the knowledge card is at the top | 426 # scroll until the knowledge card is at the top |
| 427 action_runner.ExecuteJavaScript( | 427 action_runner.ExecuteJavaScript( |
| 428 "document.getElementById('%s').scrollIntoView()" % card_id) | 428 "document.getElementById('%s').scrollIntoView()" % card_id) |
| 429 | 429 |
| 430 def RunSmoothness(self, action_runner): | 430 def RunPageInteractions(self, action_runner): |
| 431 self.ExpandKnowledgeCard(action_runner) | 431 self.ExpandKnowledgeCard(action_runner) |
| 432 | 432 |
| 433 | 433 |
| 434 class GwsGoogleExpansion(GwsExpansionPage): | 434 class GwsGoogleExpansion(GwsExpansionPage): |
| 435 | 435 |
| 436 """ Why: Animating height of a complex content card is common. """ | 436 """ Why: Animating height of a complex content card is common. """ |
| 437 | 437 |
| 438 def __init__(self, page_set): | 438 def __init__(self, page_set): |
| 439 super(GwsGoogleExpansion, self).__init__( | 439 super(GwsGoogleExpansion, self).__init__( |
| 440 url='http://www.google.com/#q=google', | 440 url='http://www.google.com/#q=google', |
| (...skipping 26 matching lines...) Expand all Loading... |
| 467 page_set=page_set) | 467 page_set=page_set) |
| 468 | 468 |
| 469 self.credentials = 'google' | 469 self.credentials = 'google' |
| 470 | 470 |
| 471 def RunNavigateSteps(self, action_runner): | 471 def RunNavigateSteps(self, action_runner): |
| 472 action_runner.NavigateToPage(self) | 472 action_runner.NavigateToPage(self) |
| 473 action_runner.WaitForJavaScriptCondition( | 473 action_runner.WaitForJavaScriptCondition( |
| 474 'document.getElementsByClassName("fHa").length > 0') | 474 'document.getElementsByClassName("fHa").length > 0') |
| 475 action_runner.Wait(2) | 475 action_runner.Wait(2) |
| 476 | 476 |
| 477 def RunSmoothness(self, action_runner): | 477 def RunPageInteractions(self, action_runner): |
| 478 interaction = action_runner.BeginGestureInteraction( | 478 interaction = action_runner.BeginGestureInteraction( |
| 479 'ScrollAction', is_smooth=True) | 479 'ScrollAction', is_smooth=True) |
| 480 action_runner.ScrollElement(selector='#mainContent') | 480 action_runner.ScrollElement(selector='#mainContent') |
| 481 interaction.End() | 481 interaction.End() |
| 482 | 482 |
| 483 | 483 |
| 484 class Page23(KeySilkCasesPage): | 484 class Page23(KeySilkCasesPage): |
| 485 | 485 |
| 486 """ | 486 """ |
| 487 Why: Physical simulation demo that does a lot of element.style mutation | 487 Why: Physical simulation demo that does a lot of element.style mutation |
| 488 triggering JS and recalc slowness | 488 triggering JS and recalc slowness |
| 489 """ | 489 """ |
| 490 | 490 |
| 491 def __init__(self, page_set): | 491 def __init__(self, page_set): |
| 492 super(Page23, self).__init__( | 492 super(Page23, self).__init__( |
| 493 url='http://jsbin.com/UVIgUTa/38/quiet', | 493 url='http://jsbin.com/UVIgUTa/38/quiet', |
| 494 page_set=page_set) | 494 page_set=page_set) |
| 495 | 495 |
| 496 def RunSmoothness(self, action_runner): | 496 def RunPageInteractions(self, action_runner): |
| 497 interaction = action_runner.BeginGestureInteraction( | 497 interaction = action_runner.BeginGestureInteraction( |
| 498 'ScrollAction', is_smooth=True) | 498 'ScrollAction', is_smooth=True) |
| 499 action_runner.ScrollPage( | 499 action_runner.ScrollPage( |
| 500 distance_expr='window.innerHeight / 2', | 500 distance_expr='window.innerHeight / 2', |
| 501 direction='down', | 501 direction='down', |
| 502 use_touch=True) | 502 use_touch=True) |
| 503 interaction.End() | 503 interaction.End() |
| 504 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 504 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
| 505 action_runner.Wait(1) | 505 action_runner.Wait(1) |
| 506 interaction.End() | 506 interaction.End() |
| 507 | 507 |
| 508 | 508 |
| 509 class Page24(KeySilkCasesPage): | 509 class Page24(KeySilkCasesPage): |
| 510 | 510 |
| 511 """ | 511 """ |
| 512 Why: Google News: this iOS version is slower than accelerated scrolling | 512 Why: Google News: this iOS version is slower than accelerated scrolling |
| 513 """ | 513 """ |
| 514 | 514 |
| 515 def __init__(self, page_set): | 515 def __init__(self, page_set): |
| 516 super(Page24, self).__init__( | 516 super(Page24, self).__init__( |
| 517 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', | 517 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', |
| 518 page_set=page_set) | 518 page_set=page_set) |
| 519 | 519 |
| 520 def RunNavigateSteps(self, action_runner): | 520 def RunNavigateSteps(self, action_runner): |
| 521 action_runner.NavigateToPage(self) | 521 action_runner.NavigateToPage(self) |
| 522 action_runner.WaitForJavaScriptCondition( | 522 action_runner.WaitForJavaScriptCondition( |
| 523 'document.getElementById(":h") != null') | 523 'document.getElementById(":h") != null') |
| 524 action_runner.Wait(1) | 524 action_runner.Wait(1) |
| 525 | 525 |
| 526 def RunSmoothness(self, action_runner): | 526 def RunPageInteractions(self, action_runner): |
| 527 interaction = action_runner.BeginGestureInteraction( | 527 interaction = action_runner.BeginGestureInteraction( |
| 528 'ScrollAction', is_smooth=True) | 528 'ScrollAction', is_smooth=True) |
| 529 action_runner.ScrollElement( | 529 action_runner.ScrollElement( |
| 530 element_function='document.getElementById(":5")', | 530 element_function='document.getElementById(":5")', |
| 531 distance=2500, | 531 distance=2500, |
| 532 use_touch=True) | 532 use_touch=True) |
| 533 interaction.End() | 533 interaction.End() |
| 534 | 534 |
| 535 | 535 |
| 536 class Page25(KeySilkCasesPage): | 536 class Page25(KeySilkCasesPage): |
| 537 | 537 |
| 538 def __init__(self, page_set): | 538 def __init__(self, page_set): |
| 539 super(Page25, self).__init__( | 539 super(Page25, self).__init__( |
| 540 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', | 540 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', |
| 541 page_set=page_set) | 541 page_set=page_set) |
| 542 | 542 |
| 543 def RunNavigateSteps(self, action_runner): | 543 def RunNavigateSteps(self, action_runner): |
| 544 action_runner.NavigateToPage(self) | 544 action_runner.NavigateToPage(self) |
| 545 action_runner.WaitForJavaScriptCondition( | 545 action_runner.WaitForJavaScriptCondition( |
| 546 'document.getElementById(":h") != null') | 546 'document.getElementById(":h") != null') |
| 547 action_runner.Wait(1) | 547 action_runner.Wait(1) |
| 548 | 548 |
| 549 def RunSmoothness(self, action_runner): | 549 def RunPageInteractions(self, action_runner): |
| 550 interaction = action_runner.BeginGestureInteraction( | 550 interaction = action_runner.BeginGestureInteraction( |
| 551 'SwipeAction', is_smooth=True) | 551 'SwipeAction', is_smooth=True) |
| 552 action_runner.SwipeElement( | 552 action_runner.SwipeElement( |
| 553 direction='left', distance=100, | 553 direction='left', distance=100, |
| 554 element_function='document.getElementById(":f")') | 554 element_function='document.getElementById(":f")') |
| 555 interaction.End() | 555 interaction.End() |
| 556 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 556 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
| 557 action_runner.Wait(1) | 557 action_runner.Wait(1) |
| 558 interaction.End() | 558 interaction.End() |
| 559 | 559 |
| 560 | 560 |
| 561 class Page26(KeySilkCasesPage): | 561 class Page26(KeySilkCasesPage): |
| 562 | 562 |
| 563 """ Why: famo.us twitter demo """ | 563 """ Why: famo.us twitter demo """ |
| 564 | 564 |
| 565 def __init__(self, page_set): | 565 def __init__(self, page_set): |
| 566 super(Page26, self).__init__( | 566 super(Page26, self).__init__( |
| 567 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', | 567 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', |
| 568 page_set=page_set) | 568 page_set=page_set) |
| 569 | 569 |
| 570 def RunNavigateSteps(self, action_runner): | 570 def RunNavigateSteps(self, action_runner): |
| 571 action_runner.NavigateToPage(self) | 571 action_runner.NavigateToPage(self) |
| 572 action_runner.WaitForJavaScriptCondition( | 572 action_runner.WaitForJavaScriptCondition( |
| 573 'document.getElementsByClassName("tweet").length > 0') | 573 'document.getElementsByClassName("tweet").length > 0') |
| 574 action_runner.Wait(1) | 574 action_runner.Wait(1) |
| 575 | 575 |
| 576 def RunSmoothness(self, action_runner): | 576 def RunPageInteractions(self, action_runner): |
| 577 interaction = action_runner.BeginGestureInteraction( | 577 interaction = action_runner.BeginGestureInteraction( |
| 578 'ScrollAction', is_smooth=True) | 578 'ScrollAction', is_smooth=True) |
| 579 action_runner.ScrollPage(distance=5000) | 579 action_runner.ScrollPage(distance=5000) |
| 580 interaction.End() | 580 interaction.End() |
| 581 | 581 |
| 582 | 582 |
| 583 class SVGIconRaster(KeySilkCasesPage): | 583 class SVGIconRaster(KeySilkCasesPage): |
| 584 | 584 |
| 585 """ Why: Mutating SVG icons; these paint storm and paint slowly. """ | 585 """ Why: Mutating SVG icons; these paint storm and paint slowly. """ |
| 586 | 586 |
| 587 def __init__(self, page_set): | 587 def __init__(self, page_set): |
| 588 super(SVGIconRaster, self).__init__( | 588 super(SVGIconRaster, self).__init__( |
| 589 url='http://wiltzius.github.io/shape-shifter/', | 589 url='http://wiltzius.github.io/shape-shifter/', |
| 590 page_set=page_set) | 590 page_set=page_set) |
| 591 | 591 |
| 592 def RunNavigateSteps(self, action_runner): | 592 def RunNavigateSteps(self, action_runner): |
| 593 action_runner.NavigateToPage(self) | 593 action_runner.NavigateToPage(self) |
| 594 action_runner.WaitForJavaScriptCondition( | 594 action_runner.WaitForJavaScriptCondition( |
| 595 'loaded = true') | 595 'loaded = true') |
| 596 action_runner.Wait(1) | 596 action_runner.Wait(1) |
| 597 | 597 |
| 598 def RunSmoothness(self, action_runner): | 598 def RunPageInteractions(self, action_runner): |
| 599 for i in xrange(9): | 599 for i in xrange(9): |
| 600 button_func = ('document.getElementById("demo").$.' | 600 button_func = ('document.getElementById("demo").$.' |
| 601 'buttons.children[%d]') % i | 601 'buttons.children[%d]') % i |
| 602 interaction = action_runner.BeginInteraction( | 602 interaction = action_runner.BeginInteraction( |
| 603 'Action_TapAction', is_smooth=True) | 603 'Action_TapAction', is_smooth=True) |
| 604 action_runner.TapElement(element_function=button_func) | 604 action_runner.TapElement(element_function=button_func) |
| 605 action_runner.Wait(1) | 605 action_runner.Wait(1) |
| 606 interaction.End() | 606 interaction.End() |
| 607 | 607 |
| 608 | 608 |
| 609 class UpdateHistoryState(KeySilkCasesPage): | 609 class UpdateHistoryState(KeySilkCasesPage): |
| 610 | 610 |
| 611 """ Why: Modern apps often update history state, which currently is janky.""" | 611 """ Why: Modern apps often update history state, which currently is janky.""" |
| 612 | 612 |
| 613 def __init__(self, page_set): | 613 def __init__(self, page_set): |
| 614 super(UpdateHistoryState, self).__init__( | 614 super(UpdateHistoryState, self).__init__( |
| 615 url='file://key_silk_cases/pushState.html', | 615 url='file://key_silk_cases/pushState.html', |
| 616 page_set=page_set) | 616 page_set=page_set) |
| 617 | 617 |
| 618 def RunNavigateSteps(self, action_runner): | 618 def RunNavigateSteps(self, action_runner): |
| 619 action_runner.NavigateToPage(self) | 619 action_runner.NavigateToPage(self) |
| 620 action_runner.ExecuteJavaScript(''' | 620 action_runner.ExecuteJavaScript(''' |
| 621 window.requestAnimationFrame(function() { | 621 window.requestAnimationFrame(function() { |
| 622 window.__history_state_loaded = true; | 622 window.__history_state_loaded = true; |
| 623 }); | 623 }); |
| 624 ''') | 624 ''') |
| 625 action_runner.WaitForJavaScriptCondition( | 625 action_runner.WaitForJavaScriptCondition( |
| 626 'window.__history_state_loaded == true;') | 626 'window.__history_state_loaded == true;') |
| 627 | 627 |
| 628 def RunSmoothness(self, action_runner): | 628 def RunPageInteractions(self, action_runner): |
| 629 interaction = action_runner.BeginInteraction('animation_interaction', | 629 interaction = action_runner.BeginInteraction('animation_interaction', |
| 630 is_smooth=True) | 630 is_smooth=True) |
| 631 action_runner.Wait(5) # JS runs the animation continuously on the page | 631 action_runner.Wait(5) # JS runs the animation continuously on the page |
| 632 interaction.End() | 632 interaction.End() |
| 633 | 633 |
| 634 | 634 |
| 635 class SilkFinance(KeySilkCasesPage): | 635 class SilkFinance(KeySilkCasesPage): |
| 636 | 636 |
| 637 """ Why: Some effects repaint the page, possibly including plenty of text. """ | 637 """ Why: Some effects repaint the page, possibly including plenty of text. """ |
| 638 | 638 |
| 639 def __init__(self, page_set): | 639 def __init__(self, page_set): |
| 640 super(SilkFinance, self).__init__( | 640 super(SilkFinance, self).__init__( |
| 641 url='file://key_silk_cases/silk_finance.html', | 641 url='file://key_silk_cases/silk_finance.html', |
| 642 page_set=page_set) | 642 page_set=page_set) |
| 643 | 643 |
| 644 def RunSmoothness(self, action_runner): | 644 def RunPageInteractions(self, action_runner): |
| 645 interaction = action_runner.BeginInteraction('animation_interaction', | 645 interaction = action_runner.BeginInteraction('animation_interaction', |
| 646 is_smooth=True) | 646 is_smooth=True) |
| 647 action_runner.Wait(10) # animation runs automatically | 647 action_runner.Wait(10) # animation runs automatically |
| 648 interaction.End() | 648 interaction.End() |
| 649 | 649 |
| 650 | 650 |
| 651 class KeySilkCasesPageSet(page_set_module.PageSet): | 651 class KeySilkCasesPageSet(page_set_module.PageSet): |
| 652 | 652 |
| 653 """ Pages hand-picked for project Silk. """ | 653 """ Pages hand-picked for project Silk. """ |
| 654 | 654 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 682 self.AddUserStory(GwsBoogieExpansion(self)) | 682 self.AddUserStory(GwsBoogieExpansion(self)) |
| 683 # Times out on Windows; crbug.com/338838 | 683 # Times out on Windows; crbug.com/338838 |
| 684 # self.AddUserStory(Page22(self)) | 684 # self.AddUserStory(Page22(self)) |
| 685 self.AddUserStory(Page23(self)) | 685 self.AddUserStory(Page23(self)) |
| 686 self.AddUserStory(Page24(self)) | 686 self.AddUserStory(Page24(self)) |
| 687 self.AddUserStory(Page25(self)) | 687 self.AddUserStory(Page25(self)) |
| 688 self.AddUserStory(Page26(self)) | 688 self.AddUserStory(Page26(self)) |
| 689 self.AddUserStory(SVGIconRaster(self)) | 689 self.AddUserStory(SVGIconRaster(self)) |
| 690 self.AddUserStory(UpdateHistoryState(self)) | 690 self.AddUserStory(UpdateHistoryState(self)) |
| 691 self.AddUserStory(SilkFinance(self)) | 691 self.AddUserStory(SilkFinance(self)) |
| OLD | NEW |