Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
Nirnimesh
2012/02/24 23:18:09
Include this test in PYAUTO_TESTS
| |
| 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 | |
|
Nirnimesh
2012/02/24 23:18:09
unused?
craigdh
2012/02/27 22:43:38
Yep. Removed.
| |
| 10 | |
| 11 | |
| 12 class PyAutoEventsTest(pyauto.PyUITest): | |
| 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.AddRaisedEventObserver(); | |
|
Nirnimesh
2012/02/24 23:18:09
id is a python keyword.
craigdh
2012/02/27 22:43:38
Done.
| |
| 19 self.NavigateToURL(url) | |
| 20 self.verifyNextEvent(id, 'init') | |
| 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): | |
|
Nirnimesh
2012/02/24 23:18:09
Method name should begin with capital letter
Prefi
craigdh
2012/02/27 22:43:38
Done.
craigdh
2012/02/27 22:43:38
Done.
| |
| 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 | |
| 33 | |
| 34 | |
| 35 if __name__ == '__main__': | |
| 36 pyauto_functional.Main() | |
| OLD | NEW |