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 | 8 |
9 | 9 |
10 class KeyDesktopSitesPage(page_module.Page): | 10 class KeyDesktopSitesPage(page_module.Page): |
(...skipping 27 matching lines...) Expand all Loading... |
38 self.scrollable_element_function = ''' | 38 self.scrollable_element_function = ''' |
39 function(callback) { | 39 function(callback) { |
40 gmonkey.load('2.0', function(api) { | 40 gmonkey.load('2.0', function(api) { |
41 callback(api.getScrollableElement()); | 41 callback(api.getScrollableElement()); |
42 }); | 42 }); |
43 }''' | 43 }''' |
44 self.credentials = 'google' | 44 self.credentials = 'google' |
45 | 45 |
46 def RunSmoothness(self, action_runner): | 46 def RunSmoothness(self, action_runner): |
47 action_runner.RunAction(ScrollAction()) | 47 action_runner.RunAction(ScrollAction()) |
48 action_runner.RunAction(WaitAction( | 48 action_runner.WaitForJavaScriptCondition( |
49 { | 49 'window.gmonkey !== undefined && ' |
50 'javascript': | 50 'document.getElementById("gb") !== null') |
51 'window.gmonkey !== undefined && document.getElementById("gb") !== null' | |
52 })) | |
53 | 51 |
54 | 52 |
55 class GoogleCalendarPage(KeyDesktopSitesPage): | 53 class GoogleCalendarPage(KeyDesktopSitesPage): |
56 | 54 |
57 def __init__(self, page_set): | 55 def __init__(self, page_set): |
58 super(GoogleCalendarPage, self).__init__( | 56 super(GoogleCalendarPage, self).__init__( |
59 url='https://www.google.com/calendar/', | 57 url='https://www.google.com/calendar/', |
60 page_set=page_set) | 58 page_set=page_set) |
61 | 59 |
62 self.scrollable_element_function = ''' | 60 self.scrollable_element_function = ''' |
(...skipping 11 matching lines...) Expand all Loading... |
74 page_set=page_set) | 72 page_set=page_set) |
75 | 73 |
76 self.scrollable_element_function = ''' | 74 self.scrollable_element_function = ''' |
77 function(callback) { | 75 function(callback) { |
78 callback(document.getElementsByClassName('doclistview-list')[0]); | 76 callback(document.getElementsByClassName('doclistview-list')[0]); |
79 }''' | 77 }''' |
80 self.credentials = 'google' | 78 self.credentials = 'google' |
81 | 79 |
82 def RunSmoothness(self, action_runner): | 80 def RunSmoothness(self, action_runner): |
83 action_runner.RunAction(ScrollAction()) | 81 action_runner.RunAction(ScrollAction()) |
84 action_runner.RunAction(WaitAction( | 82 action_runner.WaitForJavaScriptCondition( |
85 { | 83 'document.getElementsByClassName("doclistview-list").length') |
86 'javascript': | |
87 'document.getElementsByClassName("doclistview-list").length' | |
88 })) | |
89 | 84 |
90 | 85 |
91 class GoogleDocPage(KeyDesktopSitesPage): | 86 class GoogleDocPage(KeyDesktopSitesPage): |
92 | 87 |
93 def __init__(self, page_set): | 88 def __init__(self, page_set): |
94 super(GoogleDocPage, self).__init__( | 89 super(GoogleDocPage, self).__init__( |
95 # pylint: disable=C0301 | 90 # pylint: disable=C0301 |
96 url='https://docs.google.com/a/google.com/document/d/1XMAtPiVFZfItsMUOYl39
v5YA8bcSPe4LDrVO25OdsCU/edit', | 91 url='https://docs.google.com/a/google.com/document/d/1XMAtPiVFZfItsMUOYl39
v5YA8bcSPe4LDrVO25OdsCU/edit', |
97 page_set=page_set) | 92 page_set=page_set) |
98 | 93 |
99 self.scrollable_element_function = ''' | 94 self.scrollable_element_function = ''' |
100 function(callback) { | 95 function(callback) { |
101 callback(document.getElementsByClassName('kix-appview-editor')[0]); | 96 callback(document.getElementsByClassName('kix-appview-editor')[0]); |
102 }''' | 97 }''' |
103 self.credentials = 'google' | 98 self.credentials = 'google' |
104 | 99 |
105 def RunSmoothness(self, action_runner): | 100 def RunSmoothness(self, action_runner): |
106 action_runner.RunAction(ScrollAction()) | 101 action_runner.RunAction(ScrollAction()) |
107 action_runner.RunAction(WaitAction( | 102 action_runner.WaitForJavaScriptCondition( |
108 { | 103 'document.getElementsByClassName("kix-appview-editor").length') |
109 'javascript': | |
110 'document.getElementsByClassName("kix-appview-editor").length' | |
111 })) | |
112 | 104 |
113 | 105 |
114 class KeyDesktopSitesPageSet(page_set_module.PageSet): | 106 class KeyDesktopSitesPageSet(page_set_module.PageSet): |
115 | 107 |
116 """ Sites of Interest """ | 108 """ Sites of Interest """ |
117 | 109 |
118 def __init__(self): | 110 def __init__(self): |
119 super(KeyDesktopSitesPageSet, self).__init__( | 111 super(KeyDesktopSitesPageSet, self).__init__( |
120 credentials_path='data/credentials.json', | 112 credentials_path='data/credentials.json', |
121 archive_data_file='data/key_desktop_sites.json') | 113 archive_data_file='data/key_desktop_sites.json') |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 '&q=black%20screen%20amd&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20OS' | 834 '&q=black%20screen%20amd&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20OS' |
843 '%20Area%20Feature%20Status%20Owner%20Summary'), | 835 '%20Area%20Feature%20Status%20Owner%20Summary'), |
844 'http://mlb.mlb.com/index.jsp', | 836 'http://mlb.mlb.com/index.jsp', |
845 'http://www.nfl.com/', | 837 'http://www.nfl.com/', |
846 'http://airbnb.github.com/infinity/demo-on.html', | 838 'http://airbnb.github.com/infinity/demo-on.html', |
847 'http://habrahabr.ru/post/149892/#habracut' | 839 'http://habrahabr.ru/post/149892/#habracut' |
848 ] | 840 ] |
849 | 841 |
850 for url in urls_list: | 842 for url in urls_list: |
851 self.AddPage(KeyDesktopSitesPage(url, self)) | 843 self.AddPage(KeyDesktopSitesPage(url, self)) |
OLD | NEW |