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..c3892d45bf111daf6b571b1d441cea2715ab4ec4 |
--- /dev/null |
+++ b/chrome/test/functional/apptest.py |
@@ -0,0 +1,36 @@ |
+# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
dennis_jeffrey
2012/02/23 19:26:36
2011 --> 2012
craigdh
2012/02/24 01:30:02
Done.
|
+# 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 |
+ |
+ |
+class PyAutoEvents(pyauto.PyUITest): |
dennis_jeffrey
2012/02/23 19:26:36
nit: PyAutoEvents --> PyAutoEventsTest
craigdh
2012/02/24 01:30:02
Done.
|
+ |
+ def testBasicEvents(self): |
+ """Basic test for debugging the event queue.""" |
+ url = self.GetHttpURLForDataPath('apptest_basic.html') |
+ driver = self.NewWebDriver() |
+ id = self.ObserveRaisedEvents(); |
+ self.NavigateToURL(url) |
+ self.verifyNextEvent(id, 'init') |
dennis_jeffrey
2012/02/23 19:26:36
Is there a place where we can see all the event st
craigdh
2012/02/24 01:30:02
The event name is just an argument to raiseEvent()
|
+ 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): |
+ # 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 |
dennis_jeffrey
2012/02/23 19:26:36
indent by 2 fewer spaces
craigdh
2012/02/24 01:30:02
Done.
|
+ |
+ |
+if __name__ == '__main__': |
+ pyauto_functional.Main() |