| 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 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
| 5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
| 6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
| 8 | 8 |
| 9 | 9 |
| 10 class ToughSchedulingCasesPage(page_module.Page): | 10 class ToughSchedulingCasesPage(page_module.Page): |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 331 |
| 332 if slow_handler: | 332 if slow_handler: |
| 333 self.synthetic_delays = { | 333 self.synthetic_delays = { |
| 334 'blink.HandleInputEvent': {'target_duration': 0.2} | 334 'blink.HandleInputEvent': {'target_duration': 0.2} |
| 335 } | 335 } |
| 336 | 336 |
| 337 self.bounce = bounce | 337 self.bounce = bounce |
| 338 | 338 |
| 339 def RunSmoothness(self, action_runner): | 339 def RunSmoothness(self, action_runner): |
| 340 if self.bounce: | 340 if self.bounce: |
| 341 action_runner.RunAction(ScrollBounceAction()) | 341 interaction = action_runner.BeginGestureInteraction( |
| 342 'ScrollBounceAction', is_smooth=True) |
| 343 action_runner.ScrollBouncePage() |
| 344 interaction.End() |
| 342 else: | 345 else: |
| 343 interaction = action_runner.BeginGestureInteraction( | 346 interaction = action_runner.BeginGestureInteraction( |
| 344 'ScrollAction', is_smooth=True) | 347 'ScrollAction', is_smooth=True) |
| 345 # Speed and distance are tuned to run exactly as long as a scroll | 348 # Speed and distance are tuned to run exactly as long as a scroll |
| 346 # bounce. | 349 # bounce. |
| 347 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, | 350 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, |
| 348 distance=2100) | 351 distance=2100) |
| 349 interaction.End() | 352 interaction.End() |
| 350 | 353 |
| 351 | 354 |
| 352 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): | 355 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): |
| 353 | 356 |
| 354 """Why: For measuring the latency of scroll-synchronized effects.""" | 357 """Why: For measuring the latency of scroll-synchronized effects.""" |
| 355 | 358 |
| 356 def __init__(self, page_set): | 359 def __init__(self, page_set): |
| 357 super(SynchronizedScrollOffsetPage, self).__init__( | 360 super(SynchronizedScrollOffsetPage, self).__init__( |
| 358 url='file://tough_scheduling_cases/sync_scroll_offset.html', | 361 url='file://tough_scheduling_cases/sync_scroll_offset.html', |
| 359 page_set=page_set) | 362 page_set=page_set) |
| 360 | 363 |
| 361 def RunSmoothness(self, action_runner): | 364 def RunSmoothness(self, action_runner): |
| 362 action_runner.RunAction(ScrollBounceAction()) | 365 interaction = action_runner.BeginGestureInteraction( |
| 366 'ScrollBounceAction', is_smooth=True) |
| 367 action_runner.ScrollBouncePage() |
| 368 interaction.End() |
| 363 | 369 |
| 364 | 370 |
| 365 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 371 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
| 366 | 372 |
| 367 """ Tough scheduler latency test cases """ | 373 """ Tough scheduler latency test cases """ |
| 368 | 374 |
| 369 def __init__(self): | 375 def __init__(self): |
| 370 super(ToughSchedulingCasesPageSet, self).__init__() | 376 super(ToughSchedulingCasesPageSet, self).__init__() |
| 371 | 377 |
| 372 # Why: Simple scrolling baseline | 378 # Why: Simple scrolling baseline |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 # Why: Scroll bounce with slow handler on desktop, blocks only once until | 460 # Why: Scroll bounce with slow handler on desktop, blocks only once until |
| 455 # ACK timeout. | 461 # ACK timeout. |
| 456 self.AddPage(EmptyTouchHandlerPage( | 462 self.AddPage(EmptyTouchHandlerPage( |
| 457 name='bounce_desktop_slow_handler', | 463 name='bounce_desktop_slow_handler', |
| 458 desktop=True, | 464 desktop=True, |
| 459 slow_handler=True, | 465 slow_handler=True, |
| 460 bounce=True, | 466 bounce=True, |
| 461 page_set=self)) | 467 page_set=self)) |
| 462 # Why: For measuring the latency of scroll-synchronized effects. | 468 # Why: For measuring the latency of scroll-synchronized effects. |
| 463 self.AddPage(SynchronizedScrollOffsetPage(page_set=self)) | 469 self.AddPage(SynchronizedScrollOffsetPage(page_set=self)) |
| OLD | NEW |