Chromium Code Reviews| Index: chrome/test/functional/apptest.py |
| diff --git a/chrome/test/functional/apptest.py b/chrome/test/functional/apptest.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..70eb2f2ab8989ea67505f6669897b205f26b2a15 |
| --- /dev/null |
| +++ b/chrome/test/functional/apptest.py |
| @@ -0,0 +1,35 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import json |
| + |
| +import pyauto_functional # must be imported before pyauto |
| +import pyauto |
| + |
| + |
| +class PyAutoEventsTest(pyauto.PyUITest): |
| + |
| + def testBasicEvents(self): |
| + """Basic test for the event queue.""" |
| + url = self.GetHttpURLForDataPath('apptest', 'basic.html') |
| + driver = self.NewWebDriver() |
| + event_id = self.AddDomRaisedEventObserver(); |
| + self.NavigateToURL(url) |
| + self._VerifyNextEvent(event_id, 'init') |
| + self._VerifyNextEvent(event_id, 'login ready') |
| + driver.find_element_by_id('login').click() |
| + self._VerifyNextEvent(event_id, 'login start') |
| + self._VerifyNextEvent(event_id, 'login done') |
| + |
| + def _VerifyNextEvent(self, event_id, event_name): |
| + # TODO(craigdh): Temporary hack to ignore unexpected events generated by |
| + # chromedriver's use of DomAutomationController. The upcoming revision to |
| + # RaisedEvents will fix this. Note this isn't polling, just ignoring |
| + # chromedriver events. |
| + while json.loads(self.GetQueuedEvent(event_id).get('name')) != event_name: |
| + pass |
| + |
|
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
|
| + |
| +if __name__ == '__main__': |
| + pyauto_functional.Main() |