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 | 4 |
5 import re | 5 import re |
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 page_set as page_set_module | 8 from telemetry.page import page_set as page_set_module |
9 | 9 |
10 | 10 |
11 def _CreateXpathFunction(xpath): | 11 def _CreateXpathFunction(xpath): |
12 return ('document.evaluate("%s",' | 12 return ('document.evaluate("%s",' |
13 'document,' | 13 'document,' |
14 'null,' | 14 'null,' |
15 'XPathResult.FIRST_ORDERED_NODE_TYPE,' | 15 'XPathResult.FIRST_ORDERED_NODE_TYPE,' |
16 'null)' | 16 'null)' |
17 '.singleNodeValue' % re.escape(xpath)) | 17 '.singleNodeValue' % re.escape(xpath)) |
18 | 18 |
19 | 19 |
20 class GmailComposeDiscardPage(page_module.Page): | 20 class GmailComposeDiscardPage(page_module.Page): |
21 | 21 |
22 """ Why: Compose and discard a new email """ | 22 """ Why: Compose and discard a new email """ |
23 | 23 |
24 def __init__(self, page_set): | 24 def __init__(self, page_set): |
25 super(GmailComposeDiscardPage, self).__init__( | 25 super(GmailComposeDiscardPage, self).__init__( |
26 url='https://mail.google.com/mail/', | 26 url='https://mail.google.com/mail/', |
27 page_set=page_set) | 27 page_set=page_set, |
28 self.credentials_path = 'data/credentials.json' | 28 credentials_path = 'data/credentials.json') |
29 self.credentials = 'google' | 29 self.credentials = 'google' |
30 self.user_agent_type = 'desktop' | 30 self.user_agent_type = 'desktop' |
31 | 31 |
32 def RunNavigateSteps(self, action_runner): | 32 def RunNavigateSteps(self, action_runner): |
33 action_runner.NavigateToPage(self) | 33 action_runner.NavigateToPage(self) |
34 action_runner.WaitForJavaScriptCondition( | 34 action_runner.WaitForJavaScriptCondition( |
35 'window.gmonkey !== undefined &&' | 35 'window.gmonkey !== undefined &&' |
36 'document.getElementById("gb") !== null') | 36 'document.getElementById("gb") !== null') |
37 | 37 |
38 def ComposeClick(self, action_runner): | 38 def ComposeClick(self, action_runner): |
(...skipping 20 matching lines...) Expand all Loading... |
59 | 59 |
60 | 60 |
61 class GmailComposeDiscardPageSet(page_set_module.PageSet): | 61 class GmailComposeDiscardPageSet(page_set_module.PageSet): |
62 | 62 |
63 """ | 63 """ |
64 Description: Gmail endure test: compose and discard an email. | 64 Description: Gmail endure test: compose and discard an email. |
65 """ | 65 """ |
66 | 66 |
67 def __init__(self): | 67 def __init__(self): |
68 super(GmailComposeDiscardPageSet, self).__init__( | 68 super(GmailComposeDiscardPageSet, self).__init__( |
69 credentials_path='data/credentials.json', | |
70 user_agent_type='desktop') | 69 user_agent_type='desktop') |
71 | 70 |
72 self.AddPage(GmailComposeDiscardPage(self)) | 71 self.AddPage(GmailComposeDiscardPage(self)) |
OLD | NEW |