| 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 ToughSchedulingCasesPage(page_module.Page): | 8 class ToughSchedulingCasesPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set): | 10 def __init__(self, url, page_set): |
| 11 super(ToughSchedulingCasesPage, self).__init__( | 11 super(ToughSchedulingCasesPage, 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/tough_scheduling_cases.json' | 14 self.archive_data_file = 'data/tough_scheduling_cases.json' |
| 15 | 15 |
| 16 def RunSmoothness(self, action_runner): | 16 def RunPageInteractions(self, action_runner): |
| 17 interaction = action_runner.BeginGestureInteraction( | 17 interaction = action_runner.BeginGestureInteraction( |
| 18 'ScrollAction', is_smooth=True) | 18 'ScrollAction', is_smooth=True) |
| 19 action_runner.ScrollPage() | 19 action_runner.ScrollPage() |
| 20 interaction.End() | 20 interaction.End() |
| 21 | 21 |
| 22 | 22 |
| 23 class Page1(ToughSchedulingCasesPage): | 23 class Page1(ToughSchedulingCasesPage): |
| 24 | 24 |
| 25 """ Why: Simulate oversubscribed main thread """ | 25 """ Why: Simulate oversubscribed main thread """ |
| 26 | 26 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 class Page19(ToughSchedulingCasesPage): | 289 class Page19(ToughSchedulingCasesPage): |
| 290 | 290 |
| 291 """ Why: Both main and impl thread animating concurrently """ | 291 """ Why: Both main and impl thread animating concurrently """ |
| 292 | 292 |
| 293 def __init__(self, page_set): | 293 def __init__(self, page_set): |
| 294 super(Page19, self).__init__( | 294 super(Page19, self).__init__( |
| 295 url='file://tough_scheduling_cases/split_animation.html', | 295 url='file://tough_scheduling_cases/split_animation.html', |
| 296 page_set=page_set) | 296 page_set=page_set) |
| 297 | 297 |
| 298 def RunSmoothness(self, action_runner): | 298 def RunPageInteractions(self, action_runner): |
| 299 action_runner.Wait(3) | 299 action_runner.Wait(3) |
| 300 | 300 |
| 301 | 301 |
| 302 class Page20(ToughSchedulingCasesPage): | 302 class Page20(ToughSchedulingCasesPage): |
| 303 | 303 |
| 304 """ Why: Simple JS touch dragging """ | 304 """ Why: Simple JS touch dragging """ |
| 305 | 305 |
| 306 def __init__(self, page_set): | 306 def __init__(self, page_set): |
| 307 super(Page20, self).__init__( | 307 super(Page20, self).__init__( |
| 308 url='file://tough_scheduling_cases/simple_touch_drag.html', | 308 url='file://tough_scheduling_cases/simple_touch_drag.html', |
| 309 page_set=page_set) | 309 page_set=page_set) |
| 310 | 310 |
| 311 def RunSmoothness(self, action_runner): | 311 def RunPageInteractions(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='#card', | 315 selector='#card', |
| 316 use_touch=True, | 316 use_touch=True, |
| 317 direction='up', | 317 direction='up', |
| 318 speed_in_pixels_per_second=150, | 318 speed_in_pixels_per_second=150, |
| 319 distance=400) | 319 distance=400) |
| 320 interaction.End() | 320 interaction.End() |
| 321 | 321 |
| 322 | 322 |
| 323 class EmptyTouchHandlerPage(ToughSchedulingCasesPage): | 323 class EmptyTouchHandlerPage(ToughSchedulingCasesPage): |
| 324 | 324 |
| 325 """ Why: Scrolling on a page with a touch handler that consumes no events but | 325 """ Why: Scrolling on a page with a touch handler that consumes no events but |
| 326 may be slow """ | 326 may be slow """ |
| 327 | 327 |
| 328 def __init__(self, name, desktop, slow_handler, bounce, page_set): | 328 def __init__(self, name, desktop, slow_handler, bounce, page_set): |
| 329 super(EmptyTouchHandlerPage, self).__init__( | 329 super(EmptyTouchHandlerPage, self).__init__( |
| 330 url='file://tough_scheduling_cases/empty_touch_handler' + | 330 url='file://tough_scheduling_cases/empty_touch_handler' + |
| 331 ('_desktop' if desktop else '') + '.html?' + name, | 331 ('_desktop' if desktop else '') + '.html?' + name, |
| 332 page_set=page_set) | 332 page_set=page_set) |
| 333 | 333 |
| 334 if slow_handler: | 334 if slow_handler: |
| 335 self.synthetic_delays = { | 335 self.synthetic_delays = { |
| 336 'blink.HandleInputEvent': {'target_duration': 0.2} | 336 'blink.HandleInputEvent': {'target_duration': 0.2} |
| 337 } | 337 } |
| 338 | 338 |
| 339 self.bounce = bounce | 339 self.bounce = bounce |
| 340 | 340 |
| 341 def RunSmoothness(self, action_runner): | 341 def RunPageInteractions(self, action_runner): |
| 342 if self.bounce: | 342 if self.bounce: |
| 343 interaction = action_runner.BeginGestureInteraction( | 343 interaction = action_runner.BeginGestureInteraction( |
| 344 'ScrollBounceAction', is_smooth=True) | 344 'ScrollBounceAction', is_smooth=True) |
| 345 action_runner.ScrollBouncePage() | 345 action_runner.ScrollBouncePage() |
| 346 interaction.End() | 346 interaction.End() |
| 347 else: | 347 else: |
| 348 interaction = action_runner.BeginGestureInteraction( | 348 interaction = action_runner.BeginGestureInteraction( |
| 349 'ScrollAction', is_smooth=True) | 349 'ScrollAction', is_smooth=True) |
| 350 # Speed and distance are tuned to run exactly as long as a scroll | 350 # Speed and distance are tuned to run exactly as long as a scroll |
| 351 # bounce. | 351 # bounce. |
| 352 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, | 352 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, |
| 353 distance=2100) | 353 distance=2100) |
| 354 interaction.End() | 354 interaction.End() |
| 355 | 355 |
| 356 | 356 |
| 357 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): | 357 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): |
| 358 | 358 |
| 359 """Why: For measuring the latency of scroll-synchronized effects.""" | 359 """Why: For measuring the latency of scroll-synchronized effects.""" |
| 360 | 360 |
| 361 def __init__(self, page_set): | 361 def __init__(self, page_set): |
| 362 super(SynchronizedScrollOffsetPage, self).__init__( | 362 super(SynchronizedScrollOffsetPage, self).__init__( |
| 363 url='file://tough_scheduling_cases/sync_scroll_offset.html', | 363 url='file://tough_scheduling_cases/sync_scroll_offset.html', |
| 364 page_set=page_set) | 364 page_set=page_set) |
| 365 | 365 |
| 366 def RunSmoothness(self, action_runner): | 366 def RunPageInteractions(self, action_runner): |
| 367 interaction = action_runner.BeginGestureInteraction( | 367 interaction = action_runner.BeginGestureInteraction( |
| 368 'ScrollBounceAction', is_smooth=True) | 368 'ScrollBounceAction', is_smooth=True) |
| 369 action_runner.ScrollBouncePage() | 369 action_runner.ScrollBouncePage() |
| 370 interaction.End() | 370 interaction.End() |
| 371 | 371 |
| 372 | 372 |
| 373 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 373 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
| 374 | 374 |
| 375 """ Tough scheduler latency test cases """ | 375 """ Tough scheduler latency test cases """ |
| 376 | 376 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 page_set=self)) | 475 page_set=self)) |
| 476 # Why: For measuring the latency of scroll-synchronized effects. | 476 # Why: For measuring the latency of scroll-synchronized effects. |
| 477 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) | 477 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) |
| 478 # Why: Good examples of poor initial scrolling | 478 # Why: Good examples of poor initial scrolling |
| 479 self.AddUserStory(ToughSchedulingCasesPage( | 479 self.AddUserStory(ToughSchedulingCasesPage( |
| 480 'http://www.latimes.com', | 480 'http://www.latimes.com', |
| 481 self)) | 481 self)) |
| 482 self.AddUserStory(ToughSchedulingCasesPage( | 482 self.AddUserStory(ToughSchedulingCasesPage( |
| 483 'http://m.espn.go.com/nhl/rankings', | 483 'http://m.espn.go.com/nhl/rankings', |
| 484 self)) | 484 self)) |
| OLD | NEW |