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 BrowserControlClickPage(page_module.Page): | 10 class BrowserControlClickPage(page_module.Page): |
11 | 11 |
12 """ Why: Use a JavaScript .click() call to attach and detach a DOM tree | 12 """ Why: Use a JavaScript .click() call to attach and detach a DOM tree |
13 from a basic document. | 13 from a basic document. |
14 """ | 14 """ |
15 | 15 |
16 def __init__(self, page_set): | 16 def __init__(self, page_set): |
17 super(BrowserControlClickPage, self).__init__( | 17 super(BrowserControlClickPage, self).__init__( |
18 url='file://endure/browser_control_click.html', | 18 url='file://endure/browser_control_click.html', |
19 page_set=page_set, | 19 page_set=page_set, |
20 name='browser_control_click') | 20 name='browser_control_click') |
21 self.user_agent_type = 'desktop' | 21 self.user_agent_type = 'desktop' |
22 | 22 |
23 def RunNavigateSteps(self, action_runner): | 23 def RunNavigateSteps(self, action_runner): |
24 action_runner.NavigateToPage(self) | 24 action_runner.NavigateToPage(self) |
25 action_runner.RunAction(WaitAction( | 25 action_runner.WaitForElement('#attach') |
26 { | |
27 'xpath': 'id("attach")', | |
28 'condition': 'element' | |
29 })) | |
30 | 26 |
31 def RunEndure(self, action_runner): | 27 def RunEndure(self, action_runner): |
32 action_runner.RunAction(ClickElementAction( | 28 action_runner.RunAction(ClickElementAction( |
33 { | 29 { |
34 'xpath': 'id("attach")' | 30 'xpath': 'id("attach")' |
35 })) | 31 })) |
36 action_runner.RunAction(WaitAction( | 32 action_runner.Wait(0.5) |
37 { | |
38 'seconds': 0.5 | |
39 })) | |
40 action_runner.RunAction(ClickElementAction( | 33 action_runner.RunAction(ClickElementAction( |
41 { | 34 { |
42 'xpath': 'id("detach")' | 35 'xpath': 'id("detach")' |
43 })) | 36 })) |
44 action_runner.RunAction(WaitAction( | 37 action_runner.Wait(0.5) |
45 { | |
46 'seconds': 0.5 | |
47 })) | |
48 | 38 |
49 | 39 |
50 class BrowserControlClickPageSet(page_set_module.PageSet): | 40 class BrowserControlClickPageSet(page_set_module.PageSet): |
51 | 41 |
52 """ Chrome Endure control test for the browser. """ | 42 """ Chrome Endure control test for the browser. """ |
53 | 43 |
54 def __init__(self): | 44 def __init__(self): |
55 super(BrowserControlClickPageSet, self).__init__( | 45 super(BrowserControlClickPageSet, self).__init__( |
56 user_agent_type='desktop') | 46 user_agent_type='desktop') |
57 | 47 |
58 self.AddPage(BrowserControlClickPage(self)) | 48 self.AddPage(BrowserControlClickPage(self)) |
OLD | NEW |