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 RunPageInteractions(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') |
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 |
27 def __init__(self, page_set): | 27 def __init__(self, page_set): |
28 super(Page1, self).__init__( | 28 super(Page1, self).__init__( |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 """Why: Simple JS touch dragging.""" | 303 """Why: Simple JS touch dragging.""" |
304 | 304 |
305 def __init__(self, page_set): | 305 def __init__(self, page_set): |
306 super(Page20, self).__init__( | 306 super(Page20, self).__init__( |
307 url='file://tough_scheduling_cases/simple_touch_drag.html', | 307 url='file://tough_scheduling_cases/simple_touch_drag.html', |
308 page_set=page_set) | 308 page_set=page_set) |
309 | 309 |
310 def RunPageInteractions(self, action_runner): | 310 def RunPageInteractions(self, action_runner): |
311 interaction = action_runner.BeginGestureInteraction( | 311 interaction = action_runner.BeginGestureInteraction( |
312 'ScrollAction', is_smooth=True) | 312 'ScrollAction') |
313 action_runner.ScrollElement( | 313 action_runner.ScrollElement( |
314 selector='#card', | 314 selector='#card', |
315 use_touch=True, | 315 use_touch=True, |
316 direction='up', | 316 direction='up', |
317 speed_in_pixels_per_second=150, | 317 speed_in_pixels_per_second=150, |
318 distance=400) | 318 distance=400) |
319 interaction.End() | 319 interaction.End() |
320 | 320 |
321 | 321 |
322 class EmptyTouchHandlerPage(ToughSchedulingCasesPage): | 322 class EmptyTouchHandlerPage(ToughSchedulingCasesPage): |
(...skipping 10 matching lines...) Expand all Loading... |
333 if slow_handler: | 333 if slow_handler: |
334 self.synthetic_delays = { | 334 self.synthetic_delays = { |
335 'blink.HandleInputEvent': {'target_duration': 0.2} | 335 'blink.HandleInputEvent': {'target_duration': 0.2} |
336 } | 336 } |
337 | 337 |
338 self.bounce = bounce | 338 self.bounce = bounce |
339 | 339 |
340 def RunPageInteractions(self, action_runner): | 340 def RunPageInteractions(self, action_runner): |
341 if self.bounce: | 341 if self.bounce: |
342 interaction = action_runner.BeginGestureInteraction( | 342 interaction = action_runner.BeginGestureInteraction( |
343 'ScrollBounceAction', is_smooth=True) | 343 'ScrollBounceAction') |
344 action_runner.ScrollBouncePage() | 344 action_runner.ScrollBouncePage() |
345 interaction.End() | 345 interaction.End() |
346 else: | 346 else: |
347 interaction = action_runner.BeginGestureInteraction( | 347 interaction = action_runner.BeginGestureInteraction( |
348 'ScrollAction', is_smooth=True) | 348 'ScrollAction') |
349 # Speed and distance are tuned to run exactly as long as a scroll | 349 # Speed and distance are tuned to run exactly as long as a scroll |
350 # bounce. | 350 # bounce. |
351 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, | 351 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400, |
352 distance=2100) | 352 distance=2100) |
353 interaction.End() | 353 interaction.End() |
354 | 354 |
355 | 355 |
356 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): | 356 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage): |
357 | 357 |
358 """Why: For measuring the latency of scroll-synchronized effects.""" | 358 """Why: For measuring the latency of scroll-synchronized effects.""" |
359 | 359 |
360 def __init__(self, page_set): | 360 def __init__(self, page_set): |
361 super(SynchronizedScrollOffsetPage, self).__init__( | 361 super(SynchronizedScrollOffsetPage, self).__init__( |
362 url='file://tough_scheduling_cases/sync_scroll_offset.html', | 362 url='file://tough_scheduling_cases/sync_scroll_offset.html', |
363 page_set=page_set) | 363 page_set=page_set) |
364 | 364 |
365 def RunPageInteractions(self, action_runner): | 365 def RunPageInteractions(self, action_runner): |
366 interaction = action_runner.BeginGestureInteraction( | 366 interaction = action_runner.BeginGestureInteraction( |
367 'ScrollBounceAction', is_smooth=True) | 367 'ScrollBounceAction') |
368 action_runner.ScrollBouncePage() | 368 action_runner.ScrollBouncePage() |
369 interaction.End() | 369 interaction.End() |
370 | 370 |
371 | 371 |
372 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 372 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
373 | 373 |
374 """Tough scheduler latency test cases.""" | 374 """Tough scheduler latency test cases.""" |
375 | 375 |
376 def __init__(self): | 376 def __init__(self): |
377 super(ToughSchedulingCasesPageSet, self).__init__( | 377 super(ToughSchedulingCasesPageSet, self).__init__( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 # Why: Scroll bounce with slow handler on desktop, blocks only once until | 467 # Why: Scroll bounce with slow handler on desktop, blocks only once until |
468 # ACK timeout. | 468 # ACK timeout. |
469 self.AddUserStory(EmptyTouchHandlerPage( | 469 self.AddUserStory(EmptyTouchHandlerPage( |
470 name='bounce_desktop_slow_handler', | 470 name='bounce_desktop_slow_handler', |
471 desktop=True, | 471 desktop=True, |
472 slow_handler=True, | 472 slow_handler=True, |
473 bounce=True, | 473 bounce=True, |
474 page_set=self)) | 474 page_set=self)) |
475 # Why: For measuring the latency of scroll-synchronized effects. | 475 # Why: For measuring the latency of scroll-synchronized effects. |
476 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) | 476 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) |
OLD | NEW |