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..6c339a31adf8d69f765ef26a0c43c86b86d26eaa |
--- /dev/null |
+++ b/chrome/test/functional/apptest.py |
@@ -0,0 +1,36 @@ |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Nirnimesh
2012/02/24 23:18:09
Include this test in PYAUTO_TESTS
|
+# 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 |
+import pyauto_errors |
Nirnimesh
2012/02/24 23:18:09
unused?
craigdh
2012/02/27 22:43:38
Yep. Removed.
|
+ |
+ |
+class PyAutoEventsTest(pyauto.PyUITest): |
+ |
+ def testBasicEvents(self): |
+ """Basic test for debugging the event queue.""" |
+ url = self.GetHttpURLForDataPath('apptest_basic.html') |
+ driver = self.NewWebDriver() |
+ id = self.AddRaisedEventObserver(); |
Nirnimesh
2012/02/24 23:18:09
id is a python keyword.
craigdh
2012/02/27 22:43:38
Done.
|
+ self.NavigateToURL(url) |
+ self.verifyNextEvent(id, 'init') |
+ self.verifyNextEvent(id, 'login ready') |
+ driver.find_element_by_id('login').click() |
+ self.verifyNextEvent(id, 'login start') |
+ self.verifyNextEvent(id, 'login done') |
+ |
+ 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.
|
+ # 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.GetEvent(id).get('name')) != event_name: |
+ pass |
+ |
+ |
+if __name__ == '__main__': |
+ pyauto_functional.Main() |