| 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.WaitForElement('#attach') | 25 action_runner.WaitForElement('#attach') |
| 26 | 26 |
| 27 def RunEndure(self, action_runner): | 27 def RunEndure(self, action_runner): |
| 28 action_runner.RunAction(ClickElementAction( | 28 action_runner.ClickElement('#attach') |
| 29 { | |
| 30 'xpath': 'id("attach")' | |
| 31 })) | |
| 32 action_runner.Wait(0.5) | 29 action_runner.Wait(0.5) |
| 33 action_runner.RunAction(ClickElementAction( | 30 action_runner.ClickElement('#detach') |
| 34 { | |
| 35 'xpath': 'id("detach")' | |
| 36 })) | |
| 37 action_runner.Wait(0.5) | 31 action_runner.Wait(0.5) |
| 38 | 32 |
| 39 | 33 |
| 40 class BrowserControlClickPageSet(page_set_module.PageSet): | 34 class BrowserControlClickPageSet(page_set_module.PageSet): |
| 41 | 35 |
| 42 """ Chrome Endure control test for the browser. """ | 36 """ Chrome Endure control test for the browser. """ |
| 43 | 37 |
| 44 def __init__(self): | 38 def __init__(self): |
| 45 super(BrowserControlClickPageSet, self).__init__( | 39 super(BrowserControlClickPageSet, self).__init__( |
| 46 user_agent_type='desktop') | 40 user_agent_type='desktop') |
| 47 | 41 |
| 48 self.AddPage(BrowserControlClickPage(self)) | 42 self.AddPage(BrowserControlClickPage(self)) |
| OLD | NEW |