Chromium Code Reviews| 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', is_smooth=True) | 367 'ScrollBounceAction', is_smooth=True) |
| 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( | |
| 391 'LoadAction', is_smooth=True) | |
| 392 action_runner.ClickElement(selector='input[id="load"]') | |
| 393 action_runner.WaitForJavaScriptCondition('window.__ready') | |
| 394 # Click one second after the resources have finished loading. | |
| 395 action_runner.Wait(1) | |
| 396 action_runner.TapElement(selector='input[id="run"]') | |
| 397 # Wait a little bit for things to settle. | |
| 398 action_runner.Wait(.3) | |
|
rmcilroy
2015/03/17 13:59:36
Should we wait on the actual JS to finish here (or
Sami
2015/03/18 14:05:32
Right, good point. I'll make the test signal when
| |
| 399 interaction.End() | |
| 400 | |
| 401 | |
| 372 class ToughSchedulingCasesPageSet(page_set_module.PageSet): | 402 class ToughSchedulingCasesPageSet(page_set_module.PageSet): |
| 373 | 403 |
| 374 """Tough scheduler latency test cases.""" | 404 """Tough scheduler latency test cases.""" |
| 375 | 405 |
| 376 def __init__(self): | 406 def __init__(self): |
| 377 super(ToughSchedulingCasesPageSet, self).__init__( | 407 super(ToughSchedulingCasesPageSet, self).__init__( |
| 378 user_agent_type='mobile', | 408 user_agent_type='mobile', |
| 379 archive_data_file='data/tough_scheduling_cases.json', | 409 archive_data_file='data/tough_scheduling_cases.json', |
| 380 bucket=page_set_module.INTERNAL_BUCKET) | 410 bucket=page_set_module.INTERNAL_BUCKET) |
| 381 | 411 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 bounce=True, | 495 bounce=True, |
| 466 page_set=self)) | 496 page_set=self)) |
| 467 # Why: Scroll bounce with slow handler on desktop, blocks only once until | 497 # Why: Scroll bounce with slow handler on desktop, blocks only once until |
| 468 # ACK timeout. | 498 # ACK timeout. |
| 469 self.AddUserStory(EmptyTouchHandlerPage( | 499 self.AddUserStory(EmptyTouchHandlerPage( |
| 470 name='bounce_desktop_slow_handler', | 500 name='bounce_desktop_slow_handler', |
| 471 desktop=True, | 501 desktop=True, |
| 472 slow_handler=True, | 502 slow_handler=True, |
| 473 bounce=True, | 503 bounce=True, |
| 474 page_set=self)) | 504 page_set=self)) |
| 475 # Why: For measuring the latency of scroll-synchronized effects. | 505 # Why: For measuring the latency of scroll-synchronized effects. |
|
rmcilroy
2015/03/17 13:59:36
optional nit - I know it's not your patch, but cou
Sami
2015/03/18 14:05:32
Yeah, those look pretty dire. Fixed.
| |
| 476 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) | 506 self.AddUserStory(SynchronizedScrollOffsetPage(page_set=self)) |
| 507 # Why: Test loading a large amount of Javascript. | |
| 508 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='light')) | |
| 509 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='medium')) | |
| 510 self.AddUserStory(SecondBatchJsPage(page_set=self, variant='heavy')) | |
| OLD | NEW |