| 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): |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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') | 367 'ScrollBounceAction') |
| 368 action_runner.ScrollBouncePage() | 368 action_runner.ScrollBouncePage() |
| 369 interaction.End() | 369 interaction.End() |
| 370 | 370 |
| 371 | 371 |
| 372 class SecondBatchJsPage(ToughSchedulingCasesPage): |
| 373 |
| 374 """Why: For testing dynamically loading a large batch of Javascript and |
| 375 running a part of it in response to user input. |
| 376 """ |
| 377 |
| 378 def __init__(self, page_set, variant='medium'): |
| 379 super(SecondBatchJsPage, self).__init__( |
| 380 url='file://tough_scheduling_cases/second_batch_js.html?%s' % variant, |
| 381 page_set=page_set) |
| 382 |
| 383 def RunPageInteractions(self, action_runner): |
| 384 # Do a dummy tap to warm up the synthetic tap code path. |
| 385 action_runner.TapElement(selector='div[id="spinner"]') |
| 386 # Begin the action immediately because we want the page to update smoothly |
| 387 # even while resources are being loaded. |
| 388 action_runner.WaitForJavaScriptCondition('window.__ready !== undefined') |
| 389 |
| 390 interaction = action_runner.BeginGestureInteraction('LoadAction') |
| 391 action_runner.ExecuteJavaScript('kickOffLoading()') |
| 392 action_runner.WaitForJavaScriptCondition('window.__ready') |
| 393 # Click one second after the resources have finished loading. |
| 394 action_runner.Wait(1) |
| 395 action_runner.TapElement(selector='input[id="run"]') |
| 396 # Wait for the test to complete. |
| 397 action_runner.WaitForJavaScriptCondition('window.__finished') |
| 398 interaction.End() |
| 399 |
| 400 |
| 372 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 401 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
| 373 | 402 |
| 374 """Tough scheduler latency test cases.""" | 403 """Tough scheduler latency test cases.""" |
| 375 | 404 |
| 376 def __init__(self): | 405 def __init__(self): |
| 377 super(ToughSchedulingCasesPageSet, self).__init__( | 406 super(ToughSchedulingCasesPageSet, self).__init__( |
| 378 user_agent_type='mobile', | 407 user_agent_type='mobile', |
| 379 archive_data_file='data/tough_scheduling_cases.json', | 408 archive_data_file='data/tough_scheduling_cases.json', |
| 380 bucket=page_set_module.INTERNAL_BUCKET) | 409 bucket=page_set_module.INTERNAL_BUCKET) |
| 381 | 410 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 slow_handler=False, | 463 slow_handler=False, |
| 435 bounce=False, | 464 bounce=False, |
| 436 page_set=self)) | 465 page_set=self)) |
| 437 # Why: Slow handler blocks scroll start | 466 # Why: Slow handler blocks scroll start |
| 438 self.AddUserStory(EmptyTouchHandlerPage( | 467 self.AddUserStory(EmptyTouchHandlerPage( |
| 439 name='slow_handler', | 468 name='slow_handler', |
| 440 desktop=False, | 469 desktop=False, |
| 441 slow_handler=True, | 470 slow_handler=True, |
| 442 bounce=False, | 471 bounce=False, |
| 443 page_set=self)) | 472 page_set=self)) |
| 444 # Why: Slow handler blocks scroll start until touch ACK timeout | 473 # Why: Slow handler blocks scroll start until touch ACK timeout |
| 445 self.AddUserStory(EmptyTouchHandlerPage( | 474 self.AddUserStory(EmptyTouchHandlerPage( |
| 446 name='desktop_slow_handler', | 475 name='desktop_slow_handler', |
| 447 desktop=True, | 476 desktop=True, |
| 448 slow_handler=True, | 477 slow_handler=True, |
| 449 bounce=False, | 478 bounce=False, |
| 450 page_set=self)) | 479 page_set=self)) |
| 451 # Why: Scroll bounce showing repeated transitions between scrolling and | 480 # Why: Scroll bounce showing repeated transitions between scrolling and |
| 452 # sending synchronous touchmove events. Should be nearly as fast as | 481 # sending synchronous touchmove events. Should be nearly as fast as |
| 453 # scroll baseline. | 482 # scroll baseline. |
| 454 self.AddUserStory(EmptyTouchHandlerPage( | 483 self.AddUserStory(EmptyTouchHandlerPage( |
| 455 name='bounce', | 484 name='bounce', |
| 456 desktop=False, | 485 desktop=False, |
| 457 slow_handler=False, | 486 slow_handler=False, |
| 458 bounce=True, | 487 bounce=True, |
| 459 page_set=self)) | 488 page_set=self)) |
| 460 # Why: Scroll bounce with slow handler, repeated blocking. | 489 # Why: Scroll bounce with slow handler, repeated blocking. |
| 461 self.AddUserStory(EmptyTouchHandlerPage( | 490 self.AddUserStory(EmptyTouchHandlerPage( |
| 462 name='bounce_slow_handler', | 491 name='bounce_slow_handler', |
| 463 desktop=False, | 492 desktop=False, |
| 464 slow_handler=True, | 493 slow_handler=True, |
| 465 bounce=True, | 494 bounce=True, |
| 466 page_set=self)) | 495 page_set=self)) |
| 467 # Why: Scroll bounce with slow handler on desktop, blocks only once until | 496 # Why: Scroll bounce with slow handler on desktop, blocks only once until |
| 468 # ACK timeout. | 497 # ACK timeout. |
| 469 self.AddUserStory(EmptyTouchHandlerPage( | 498 self.AddUserStory(EmptyTouchHandlerPage( |
| 470 name='bounce_desktop_slow_handler', | 499 name='bounce_desktop_slow_handler', |
| 471 desktop=True, | 500 desktop=True, |
| 472 slow_handler=True, | 501 slow_handler=True, |
| 473 bounce=True, | 502 bounce=True, |
| 474 page_set=self)) | 503 page_set=self)) |
| 475 # Why: For measuring the latency of scroll-synchronized effects. | 504 # Why: For measuring the latency of scroll-synchronized effects. |
| 476 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) | 505 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) |
| 506 # Why: Test loading a large amount of Javascript. |
| 507 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='light')) |
| 508 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='medium')) |
| 509 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='heavy')) |
| OLD | NEW |