OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
dennis_jeffrey
2012/02/23 19:26:36
2011 --> 2012
craigdh
2012/02/24 01:30:02
Done.
| |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import json | |
6 | |
7 import pyauto_functional # must be imported before pyauto | |
8 import pyauto | |
9 import pyauto_errors | |
10 | |
11 | |
12 class PyAutoEvents(pyauto.PyUITest): | |
dennis_jeffrey
2012/02/23 19:26:36
nit: PyAutoEvents --> PyAutoEventsTest
craigdh
2012/02/24 01:30:02
Done.
| |
13 | |
14 def testBasicEvents(self): | |
15 """Basic test for debugging the event queue.""" | |
16 url = self.GetHttpURLForDataPath('apptest_basic.html') | |
17 driver = self.NewWebDriver() | |
18 id = self.ObserveRaisedEvents(); | |
19 self.NavigateToURL(url) | |
20 self.verifyNextEvent(id, 'init') | |
dennis_jeffrey
2012/02/23 19:26:36
Is there a place where we can see all the event st
craigdh
2012/02/24 01:30:02
The event name is just an argument to raiseEvent()
| |
21 self.verifyNextEvent(id, 'login ready') | |
22 driver.find_element_by_id('login').click() | |
23 self.verifyNextEvent(id, 'login start') | |
24 self.verifyNextEvent(id, 'login done') | |
25 | |
26 def verifyNextEvent(self, id, event_name): | |
27 # TODO(craigdh): Temporary hack to ignore unexpected events generated by | |
28 # chromedriver's use of DomAutomationController. The upcoming revision to | |
29 # RaisedEvents will fix this. Note this isn't polling, just ignoring | |
30 # chromedriver events. | |
31 while json.loads(self.GetEvent(id).get('name')) != event_name: | |
32 pass | |
dennis_jeffrey
2012/02/23 19:26:36
indent by 2 fewer spaces
craigdh
2012/02/24 01:30:02
Done.
| |
33 | |
34 | |
35 if __name__ == '__main__': | |
36 pyauto_functional.Main() | |
OLD | NEW |