| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 | 4 |
| 5 from page_sets.login_helpers import google_login | 5 from page_sets.login_helpers import google_login |
| 6 | 6 |
| 7 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 8 from telemetry.page import shared_page_state | 8 from telemetry.page import shared_page_state |
| 9 from telemetry.util import js_template | |
| 10 | 9 |
| 11 import os | 10 import os |
| 12 | 11 |
| 13 def _DeterministicPerformanceCounters(): | 12 def _DeterministicPerformanceCounters(): |
| 14 with open(os.path.join(os.path.dirname(__file__), | 13 with open(os.path.join(os.path.dirname(__file__), |
| 15 'deterministic_performance_counters.js')) as f: | 14 'deterministic_performance_counters.js')) as f: |
| 16 return f.read() | 15 return f.read() |
| 17 | 16 |
| 18 class GooglePages(page_module.Page): | 17 class GooglePages(page_module.Page): |
| 19 def __init__(self, url, page_set, shared_page_state_class, | 18 def __init__(self, url, page_set, shared_page_state_class, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 page_set=page_set, | 50 page_set=page_set, |
| 52 shared_page_state_class=shared_page_state_class) | 51 shared_page_state_class=shared_page_state_class) |
| 53 | 52 |
| 54 def RunNavigateSteps(self, action_runner): | 53 def RunNavigateSteps(self, action_runner): |
| 55 google_login.LoginGoogleAccount(action_runner, 'google', | 54 google_login.LoginGoogleAccount(action_runner, 'google', |
| 56 self.credentials_path) | 55 self.credentials_path) |
| 57 super(GoogleDocPage, self).RunNavigateSteps(action_runner) | 56 super(GoogleDocPage, self).RunNavigateSteps(action_runner) |
| 58 action_runner.Wait(2) | 57 action_runner.Wait(2) |
| 59 action_runner.WaitForJavaScriptCondition( | 58 action_runner.WaitForJavaScriptCondition( |
| 60 'document.getElementsByClassName("kix-appview-editor").length') | 59 'document.getElementsByClassName("kix-appview-editor").length') |
| 61 | |
| 62 | |
| 63 INTERACTION_NAME = 'Interaction.AppLoad' | |
| 64 class AdwordCampaignDesktopPage(page_module.Page): | |
| 65 def __init__(self, page_set): | |
| 66 super(AdwordCampaignDesktopPage, self).__init__( | |
| 67 url='https://adwords.google.com/cm/CampaignMgmt', | |
| 68 page_set=page_set, name='AdwordsCampaign', | |
| 69 credentials_path='data/credentials.json', | |
| 70 shared_page_state_class=shared_page_state.SharedDesktopPageState) | |
| 71 self.script_to_evaluate_on_commit = js_template.Render( | |
| 72 'console.time({{ label }});', label=INTERACTION_NAME) | |
| 73 | |
| 74 def RunNavigateSteps(self, action_runner): | |
| 75 google_login.LoginGoogleAccount(action_runner, 'google3', | |
| 76 self.credentials_path) | |
| 77 super(AdwordCampaignDesktopPage, self).RunNavigateSteps(action_runner) | |
| 78 | |
| 79 def RunPageInteractions(self, action_runner): | |
| 80 action_runner.WaitForElement(text='Welcome to AdWords!') | |
| 81 action_runner.ExecuteJavaScript( | |
| 82 'console.timeEnd({{ label }});', label=INTERACTION_NAME) | |
| OLD | NEW |