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 GmailComposeDiscardPage(page_module.Page): | 10 class GmailComposeDiscardPage(page_module.Page): |
(...skipping 11 matching lines...) Expand all Loading... |
22 def RunNavigateSteps(self, action_runner): | 22 def RunNavigateSteps(self, action_runner): |
23 action_runner.NavigateToPage(self) | 23 action_runner.NavigateToPage(self) |
24 action_runner.RunAction(WaitAction( | 24 action_runner.RunAction(WaitAction( |
25 { | 25 { |
26 'javascript': ( | 26 'javascript': ( |
27 'window.gmonkey !== undefined &&' | 27 'window.gmonkey !== undefined &&' |
28 'document.getElementById("gb") !== null') | 28 'document.getElementById("gb") !== null') |
29 })) | 29 })) |
30 | 30 |
31 def ComposeClick(self, action_runner): | 31 def ComposeClick(self, action_runner): |
32 action_runner.RunAction(JavascriptAction({ | 32 action_runner.ExecuteJavaScript(''' |
33 'expression': ''' | |
34 var button=document.evaluate('//div[text()="COMPOSE"]', | 33 var button=document.evaluate('//div[text()="COMPOSE"]', |
35 document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null) | 34 document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null) |
36 .singleNodeValue; | 35 .singleNodeValue; |
37 var mousedownevent=new MouseEvent('mousedown',true,true,window,0,0,0,0,0, | 36 var mousedownevent=new MouseEvent('mousedown',true,true,window,0,0,0,0,0, |
38 false,false,false,false,0,null); | 37 false,false,false,false,0,null); |
39 var mouseupevent=new MouseEvent('mouseup',true,true,window,0,0,0,0,0, | 38 var mouseupevent=new MouseEvent('mouseup',true,true,window,0,0,0,0,0, |
40 false,false,false,false,0,null); | 39 false,false,false,false,0,null); |
41 button.dispatchEvent(mousedownevent); | 40 button.dispatchEvent(mousedownevent); |
42 button.dispatchEvent(mouseupevent);''' | 41 button.dispatchEvent(mouseupevent);''') |
43 })) | |
44 | 42 |
45 def RunEndure(self, action_runner): | 43 def RunEndure(self, action_runner): |
46 action_runner.RunAction(WaitAction( | 44 action_runner.RunAction(WaitAction( |
47 { | 45 { |
48 'xpath': '//div[text()="COMPOSE"]', | 46 'xpath': '//div[text()="COMPOSE"]', |
49 'condition': 'element' | 47 'condition': 'element' |
50 })) | 48 })) |
51 self.ComposeClick(action_runner) | 49 self.ComposeClick(action_runner) |
52 action_runner.RunAction(WaitAction({"seconds": 1})) | 50 action_runner.RunAction(WaitAction({"seconds": 1})) |
53 action_runner.RunAction(WaitAction( | 51 action_runner.RunAction(WaitAction( |
(...skipping 13 matching lines...) Expand all Loading... |
67 """ | 65 """ |
68 Description: Gmail endure test: compose and discard an email. | 66 Description: Gmail endure test: compose and discard an email. |
69 """ | 67 """ |
70 | 68 |
71 def __init__(self): | 69 def __init__(self): |
72 super(GmailComposeDiscardPageSet, self).__init__( | 70 super(GmailComposeDiscardPageSet, self).__init__( |
73 credentials_path='data/credentials.json', | 71 credentials_path='data/credentials.json', |
74 user_agent_type='desktop') | 72 user_agent_type='desktop') |
75 | 73 |
76 self.AddPage(GmailComposeDiscardPage(self)) | 74 self.AddPage(GmailComposeDiscardPage(self)) |
OLD | NEW |