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 from telemetry.web_perf import timeline_interaction_record as tir_module | |
9 | 8 |
10 | 9 |
11 class KeySilkCasesPage(page_module.Page): | 10 class KeySilkCasesPage(page_module.Page): |
12 | 11 |
13 def __init__(self, url, page_set): | 12 def __init__(self, url, page_set): |
14 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) | 13 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) |
15 self.credentials_path = 'data/credentials.json' | 14 self.credentials_path = 'data/credentials.json' |
16 self.user_agent_type = 'mobile' | 15 self.user_agent_type = 'mobile' |
17 self.archive_data_file = 'data/key_silk_cases.json' | 16 self.archive_data_file = 'data/key_silk_cases.json' |
18 | 17 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 'left_start_percentage': 0.8, | 291 'left_start_percentage': 0.8, |
293 'distance': 200, | 292 'distance': 200, |
294 'direction': 'left', | 293 'direction': 'left', |
295 'top_start_percentage': 0.2, | 294 'top_start_percentage': 0.2, |
296 'element_function': ''' | 295 'element_function': ''' |
297 function(callback) { | 296 function(callback) { |
298 callback(document.getElementsByClassName('message')[2]); | 297 callback(document.getElementsByClassName('message')[2]); |
299 }''', | 298 }''', |
300 'speed': 5000 | 299 'speed': 5000 |
301 })) | 300 })) |
302 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) | 301 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
303 action_runner.RunAction(WaitAction({ | 302 action_runner.RunAction(WaitAction({ |
304 'javascript': 'document.getElementsByClassName("message").length < 18' | 303 'javascript': 'document.getElementsByClassName("message").length < 18' |
305 })) | 304 })) |
306 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) | 305 interaction.End() |
307 | 306 |
308 def RunSmoothness(self, action_runner): | 307 def RunSmoothness(self, action_runner): |
309 self.SwipeToDismiss(action_runner) | 308 self.SwipeToDismiss(action_runner) |
310 | 309 |
311 | 310 |
312 class Page17(KeySilkCasesPage): | 311 class Page17(KeySilkCasesPage): |
313 | 312 |
314 def __init__(self, page_set): | 313 def __init__(self, page_set): |
315 super(Page17, self).__init__( | 314 super(Page17, self).__init__( |
316 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', | 315 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 def __init__(self, page_set): | 383 def __init__(self, page_set): |
385 super(Page19, self).__init__( | 384 super(Page19, self).__init__( |
386 url='file://key_silk_cases/inbox_app.html?slide_drawer', | 385 url='file://key_silk_cases/inbox_app.html?slide_drawer', |
387 page_set=page_set) | 386 page_set=page_set) |
388 | 387 |
389 def ToggleDrawer(self, action_runner): | 388 def ToggleDrawer(self, action_runner): |
390 action_runner.RunAction(TapAction( | 389 action_runner.RunAction(TapAction( |
391 { | 390 { |
392 'selector': '#menu-button' | 391 'selector': '#menu-button' |
393 })) | 392 })) |
394 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) | 393 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
395 action_runner.RunAction(WaitAction({ | 394 action_runner.RunAction(WaitAction({ |
396 'javascript': 'document.getElementById("nav-drawer").active' | 395 'javascript': 'document.getElementById("nav-drawer").active' |
397 })) | 396 })) |
398 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) | 397 interaction.End() |
399 | 398 |
400 | 399 |
401 def RunNavigateSteps(self, action_runner): | 400 def RunNavigateSteps(self, action_runner): |
402 action_runner.NavigateToPage(self) | 401 action_runner.NavigateToPage(self) |
403 action_runner.RunAction(WaitAction({'seconds': 2})) | 402 action_runner.RunAction(WaitAction({'seconds': 2})) |
404 self.ToggleDrawer(action_runner) | 403 self.ToggleDrawer(action_runner) |
405 | 404 |
406 def RunSmoothness(self, action_runner): | 405 def RunSmoothness(self, action_runner): |
407 self.SlideDrawer(action_runner) | 406 self.SlideDrawer(action_runner) |
408 | 407 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 page_set=page_set) | 527 page_set=page_set) |
529 | 528 |
530 def RunSmoothness(self, action_runner): | 529 def RunSmoothness(self, action_runner): |
531 action_runner.RunAction(ScrollAction( | 530 action_runner.RunAction(ScrollAction( |
532 { | 531 { |
533 'direction': 'down', | 532 'direction': 'down', |
534 'scroll_requires_touch': True, | 533 'scroll_requires_touch': True, |
535 'scroll_distance_function': | 534 'scroll_distance_function': |
536 'function() { return window.innerHeight / 2; }' | 535 'function() { return window.innerHeight / 2; }' |
537 })) | 536 })) |
538 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) | 537 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
539 action_runner.RunAction(WaitAction({'seconds' : 1})) | 538 action_runner.RunAction(WaitAction({'seconds' : 1})) |
540 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) | 539 interaction.End() |
541 | 540 |
542 | 541 |
543 class Page24(KeySilkCasesPage): | 542 class Page24(KeySilkCasesPage): |
544 | 543 |
545 """ | 544 """ |
546 Why: Google News: this iOS version is slower than accelerated scrolling | 545 Why: Google News: this iOS version is slower than accelerated scrolling |
547 """ | 546 """ |
548 | 547 |
549 def __init__(self, page_set): | 548 def __init__(self, page_set): |
550 super(Page24, self).__init__( | 549 super(Page24, self).__init__( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 def RunSmoothness(self, action_runner): | 592 def RunSmoothness(self, action_runner): |
594 action_runner.RunAction(SwipeAction( | 593 action_runner.RunAction(SwipeAction( |
595 { | 594 { |
596 'distance': 100, | 595 'distance': 100, |
597 'direction': "left", | 596 'direction': "left", |
598 'element_function': ''' | 597 'element_function': ''' |
599 function(callback) { | 598 function(callback) { |
600 callback(document.getElementById(':f')); | 599 callback(document.getElementById(':f')); |
601 }''' | 600 }''' |
602 })) | 601 })) |
603 action_runner.BeginInteraction('Wait', [tir_module.IS_SMOOTH]) | 602 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
604 action_runner.RunAction(WaitAction({'seconds' : 1})) | 603 action_runner.RunAction(WaitAction({'seconds' : 1})) |
605 action_runner.EndInteraction('Wait', [tir_module.IS_SMOOTH]) | 604 interaction.End() |
606 | 605 |
607 | 606 |
608 class Page26(KeySilkCasesPage): | 607 class Page26(KeySilkCasesPage): |
609 | 608 |
610 """ Why: famo.us twitter demo """ | 609 """ Why: famo.us twitter demo """ |
611 | 610 |
612 def __init__(self, page_set): | 611 def __init__(self, page_set): |
613 super(Page26, self).__init__( | 612 super(Page26, self).__init__( |
614 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', | 613 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', |
615 page_set=page_set) | 614 page_set=page_set) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 self.AddPage(Page17(self)) | 660 self.AddPage(Page17(self)) |
662 self.AddPage(Page18(self)) | 661 self.AddPage(Page18(self)) |
663 self.AddPage(Page19(self)) | 662 self.AddPage(Page19(self)) |
664 self.AddPage(Page20(self)) | 663 self.AddPage(Page20(self)) |
665 self.AddPage(Page21(self)) | 664 self.AddPage(Page21(self)) |
666 self.AddPage(Page22(self)) | 665 self.AddPage(Page22(self)) |
667 self.AddPage(Page23(self)) | 666 self.AddPage(Page23(self)) |
668 self.AddPage(Page24(self)) | 667 self.AddPage(Page24(self)) |
669 self.AddPage(Page25(self)) | 668 self.AddPage(Page25(self)) |
670 self.AddPage(Page26(self)) | 669 self.AddPage(Page26(self)) |
OLD | NEW |