Chromium Code Reviews| 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._VerifyNextEvent(event_id, 'init') | |
| 20 self._VerifyNextEvent(event_id, 'login ready') | |
| 21 driver.find_element_by_id('login').click() | |
| 22 self._VerifyNextEvent(event_id, 'login start') | |
| 23 self._VerifyNextEvent(event_id, 'login done') | |
| 24 | |
| 25 def _VerifyNextEvent(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.GetQueuedEvent(event_id).get('name')) != event_name: | |
| 31 pass | |
| 32 | |
|
Nirnimesh
2012/02/28 09:13:09
You aren't "verifying" anything in this method
as
craigdh
2012/02/28 22:42:56
Renamed "_ExpectEvent". The upcoming fixed version
| |
| 33 | |
| 34 if __name__ == '__main__': | |
| 35 pyauto_functional.Main() | |
| OLD | NEW |