| 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 shared_page_state | 5 from telemetry.page import shared_page_state |
| 6 from telemetry import story | 6 from telemetry import story |
| 7 | 7 |
| 8 | 8 |
| 9 class SimplePage(page_module.Page): | 9 class SimplePage(page_module.Page): |
| 10 def __init__(self, url, page_set, credentials='', name=''): | 10 def __init__(self, url, page_set, credentials='', name=''): |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 class Gmail(SimplePage): | 31 class Gmail(SimplePage): |
| 32 def __init__(self, page_set): | 32 def __init__(self, page_set): |
| 33 super(Gmail, self).__init__( | 33 super(Gmail, self).__init__( |
| 34 url='https://mail.google.com/mail/', | 34 url='https://mail.google.com/mail/', |
| 35 page_set=page_set, | 35 page_set=page_set, |
| 36 credentials='google') | 36 credentials='google') |
| 37 | 37 |
| 38 def RunNavigateSteps(self, action_runner): | 38 def RunNavigateSteps(self, action_runner): |
| 39 super(Gmail, self).RunNavigateSteps(action_runner) | 39 super(Gmail, self).RunNavigateSteps(action_runner) |
| 40 action_runner.WaitForJavaScriptCondition2( | 40 action_runner.WaitForJavaScriptCondition( |
| 41 'window.gmonkey !== undefined &&' | 41 'window.gmonkey !== undefined &&' |
| 42 'document.getElementById("gb") !== null') | 42 'document.getElementById("gb") !== null') |
| 43 | 43 |
| 44 | 44 |
| 45 class GoogleCalendar(SimplePage): | 45 class GoogleCalendar(SimplePage): |
| 46 def __init__(self, page_set): | 46 def __init__(self, page_set): |
| 47 super(GoogleCalendar, self).__init__( | 47 super(GoogleCalendar, self).__init__( |
| 48 url='https://www.google.com/calendar/', | 48 url='https://www.google.com/calendar/', |
| 49 page_set=page_set, | 49 page_set=page_set, |
| 50 credentials='google') | 50 credentials='google') |
| 51 | 51 |
| 52 def RunNavigateSteps(self, action_runner): | 52 def RunNavigateSteps(self, action_runner): |
| 53 super(GoogleCalendar, self).RunNavigateSteps(action_runner) | 53 super(GoogleCalendar, self).RunNavigateSteps(action_runner) |
| 54 action_runner.ExecuteJavaScript2(''' | 54 action_runner.ExecuteJavaScript(''' |
| 55 (function() { var elem = document.createElement("meta"); | 55 (function() { var elem = document.createElement("meta"); |
| 56 elem.name="viewport"; | 56 elem.name="viewport"; |
| 57 elem.content="initial-scale=1"; | 57 elem.content="initial-scale=1"; |
| 58 document.body.appendChild(elem); | 58 document.body.appendChild(elem); |
| 59 })();''') | 59 })();''') |
| 60 action_runner.Wait(2) | 60 action_runner.Wait(2) |
| 61 action_runner.WaitForElement('div[class~="navForward"]') | 61 action_runner.WaitForElement('div[class~="navForward"]') |
| 62 | 62 |
| 63 | 63 |
| 64 class Youtube(SimplePage): | 64 class Youtube(SimplePage): |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 self.AddStory(GoogleCalendar(self)) | 142 self.AddStory(GoogleCalendar(self)) |
| 143 self.AddStory(Youtube(self)) | 143 self.AddStory(Youtube(self)) |
| 144 # crbug.com/662381. | 144 # crbug.com/662381. |
| 145 #self.AddStory(Facebook(self)) | 145 #self.AddStory(Facebook(self)) |
| 146 self.AddStory(SimplePage('http://en.wikipedia.org/wiki/Wikipedia', | 146 self.AddStory(SimplePage('http://en.wikipedia.org/wiki/Wikipedia', |
| 147 self, name='Wikipedia')) | 147 self, name='Wikipedia')) |
| 148 self.AddStory(SimplePage('http://www.amazon.com', self)) | 148 self.AddStory(SimplePage('http://www.amazon.com', self)) |
| 149 self.AddStory(SimplePage('http://www.yahoo.com/', self)) | 149 self.AddStory(SimplePage('http://www.yahoo.com/', self)) |
| 150 self.AddStory(SimplePage('http://www.bing.com/', self)) | 150 self.AddStory(SimplePage('http://www.bing.com/', self)) |
| 151 self.AddStory(SimplePage('http://www.ask.com/', self)) | 151 self.AddStory(SimplePage('http://www.ask.com/', self)) |
| OLD | NEW |