| 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 | |
| 401 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 372 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
| 402 | 373 |
| 403 """Tough scheduler latency test cases.""" | 374 """Tough scheduler latency test cases.""" |
| 404 | 375 |
| 405 def __init__(self): | 376 def __init__(self): |
| 406 super(ToughSchedulingCasesPageSet, self).__init__( | 377 super(ToughSchedulingCasesPageSet, self).__init__( |
| 407 user_agent_type='mobile', | 378 user_agent_type='mobile', |
| 408 archive_data_file='data/tough_scheduling_cases.json', | 379 archive_data_file='data/tough_scheduling_cases.json', |
| 409 bucket=page_set_module.INTERNAL_BUCKET) | 380 bucket=page_set_module.INTERNAL_BUCKET) |
| 410 | 381 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 slow_handler=False, | 434 slow_handler=False, |
| 464 bounce=False, | 435 bounce=False, |
| 465 page_set=self)) | 436 page_set=self)) |
| 466 # Why: Slow handler blocks scroll start | 437 # Why: Slow handler blocks scroll start |
| 467 self.AddUserStory(EmptyTouchHandlerPage( | 438 self.AddUserStory(EmptyTouchHandlerPage( |
| 468 name='slow_handler', | 439 name='slow_handler', |
| 469 desktop=False, | 440 desktop=False, |
| 470 slow_handler=True, | 441 slow_handler=True, |
| 471 bounce=False, | 442 bounce=False, |
| 472 page_set=self)) | 443 page_set=self)) |
| 473 # Why: Slow handler blocks scroll start until touch ACK timeout | 444 # Why: Slow handler blocks scroll start until touch ACK timeout |
| 474 self.AddUserStory(EmptyTouchHandlerPage( | 445 self.AddUserStory(EmptyTouchHandlerPage( |
| 475 name='desktop_slow_handler', | 446 name='desktop_slow_handler', |
| 476 desktop=True, | 447 desktop=True, |
| 477 slow_handler=True, | 448 slow_handler=True, |
| 478 bounce=False, | 449 bounce=False, |
| 479 page_set=self)) | 450 page_set=self)) |
| 480 # Why: Scroll bounce showing repeated transitions between scrolling and | 451 # Why: Scroll bounce showing repeated transitions between scrolling and |
| 481 # sending synchronous touchmove events. Should be nearly as fast as | 452 # sending synchronous touchmove events. Should be nearly as fast as |
| 482 # scroll baseline. | 453 # scroll baseline. |
| 483 self.AddUserStory(EmptyTouchHandlerPage( | 454 self.AddUserStory(EmptyTouchHandlerPage( |
| 484 name='bounce', | 455 name='bounce', |
| 485 desktop=False, | 456 desktop=False, |
| 486 slow_handler=False, | 457 slow_handler=False, |
| 487 bounce=True, | 458 bounce=True, |
| 488 page_set=self)) | 459 page_set=self)) |
| 489 # Why: Scroll bounce with slow handler, repeated blocking. | 460 # Why: Scroll bounce with slow handler, repeated blocking. |
| 490 self.AddUserStory(EmptyTouchHandlerPage( | 461 self.AddUserStory(EmptyTouchHandlerPage( |
| 491 name='bounce_slow_handler', | 462 name='bounce_slow_handler', |
| 492 desktop=False, | 463 desktop=False, |
| 493 slow_handler=True, | 464 slow_handler=True, |
| 494 bounce=True, | 465 bounce=True, |
| 495 page_set=self)) | 466 page_set=self)) |
| 496 # 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 |
| 497 # ACK timeout. | 468 # ACK timeout. |
| 498 self.AddUserStory(EmptyTouchHandlerPage( | 469 self.AddUserStory(EmptyTouchHandlerPage( |
| 499 name='bounce_desktop_slow_handler', | 470 name='bounce_desktop_slow_handler', |
| 500 desktop=True, | 471 desktop=True, |
| 501 slow_handler=True, | 472 slow_handler=True, |
| 502 bounce=True, | 473 bounce=True, |
| 503 page_set=self)) | 474 page_set=self)) |
| 504 # Why: For measuring the latency of scroll-synchronized effects. | 475 # Why: For measuring the latency of scroll-synchronized effects. |
| 505 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) | 476 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 |