OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
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 | |
10 | |
11 class PyAutoEventsTest(pyauto.PyUITest): | |
12 | |
13 def testBasicEvents(self): | |
14 """Basic test for the event queue.""" | |
15 url = self.GetHttpURLForDataPath('apptest', 'basic.html') | |
16 driver = self.NewWebDriver() | |
17 event_id = self.AddDomRaisedEventObserver(); | |
18 self.NavigateToURL(url) | |
19 self._ExpectEvent(event_id, 'init') | |
20 self._ExpectEvent(event_id, 'login ready') | |
21 driver.find_element_by_id('login').click() | |
22 self._ExpectEvent(event_id, 'login start') | |
23 self._ExpectEvent(event_id, 'login done') | |
24 | |
25 def _ExpectEvent(self, event_id, event_name): | |
26 # TODO(craigdh): Temporary hack to ignore unexpected events generated by | |
27 # chromedriver's use of DomAutomationController. The upcoming revision to | |
28 # RaisedEvents will fix this. Note this isn't polling, just ignoring | |
29 # chromedriver events. | |
30 while json.loads(self.GetNextEvent(event_id).get('name')) != event_name: | |
Nirnimesh
2012/02/29 03:22:08
if the test fails, this will be stuck forever. Run
craigdh
2012/02/29 22:53:43
Changed to just throw out anything that looks like
| |
31 pass | |
32 | |
33 | |
34 if __name__ == '__main__': | |
35 pyauto_functional.Main() | |
OLD | NEW |