| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 from telemetry.page import page as page_module | |
| 5 from telemetry.page import page_set as page_set_module | |
| 6 | |
| 7 | |
| 8 def _GetCurrentLocation(action_runner): | |
| 9 return action_runner.EvaluateJavaScript('document.location.href') | |
| 10 | |
| 11 | |
| 12 def _WaitForLocationChange(action_runner, old_href): | |
| 13 action_runner.WaitForJavaScriptCondition( | |
| 14 'document.location.href != "%s"' % old_href) | |
| 15 | |
| 16 | |
| 17 class GmailAltTwoLabelsPage(page_module.Page): | |
| 18 | |
| 19 """ Why: Alternate between Inbox and Sent Mail """ | |
| 20 | |
| 21 def __init__(self, page_set): | |
| 22 super(GmailAltTwoLabelsPage, self).__init__( | |
| 23 url='https://mail.google.com/mail/', | |
| 24 page_set=page_set, | |
| 25 name='gmail_alt_two_labels', | |
| 26 credentials_path = 'data/credentials.json') | |
| 27 self.credentials = 'google' | |
| 28 self.user_agent_type = 'desktop' | |
| 29 self.archive_data_file = 'data/gmail_alt_two_labels.json' | |
| 30 | |
| 31 def RunNavigateSteps(self, action_runner): | |
| 32 action_runner.NavigateToPage(self) | |
| 33 action_runner.WaitForJavaScriptCondition( | |
| 34 'window.gmonkey !== undefined && ' | |
| 35 'document.getElementById("gb") !== null') | |
| 36 | |
| 37 def RunEndure(self, action_runner): | |
| 38 old_href = _GetCurrentLocation(action_runner) | |
| 39 action_runner.ClickElement( | |
| 40 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]') | |
| 41 _WaitForLocationChange(action_runner, old_href) | |
| 42 action_runner.Wait(1) | |
| 43 old_href = _GetCurrentLocation(action_runner) | |
| 44 action_runner.ClickElement( | |
| 45 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') | |
| 46 _WaitForLocationChange(action_runner, old_href) | |
| 47 action_runner.Wait(1) | |
| 48 | |
| 49 | |
| 50 class GmailAltTwoLabelsPageSet(page_set_module.PageSet): | |
| 51 | |
| 52 """ Chrome Endure test for GMail. """ | |
| 53 | |
| 54 def __init__(self): | |
| 55 super(GmailAltTwoLabelsPageSet, self).__init__( | |
| 56 user_agent_type='desktop', | |
| 57 archive_data_file='data/gmail_alt_two_labels.json', | |
| 58 bucket=page_set_module.PUBLIC_BUCKET) | |
| 59 | |
| 60 self.AddPage(GmailAltTwoLabelsPage(self)) | |
| OLD | NEW |