Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8383)

Unified Diff: chrome/test/functional/apptest.py

Issue 9372120: Implementation of AutomationEventQueue and associated framework to support generic non-blocking aut… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Nirnimesh's most recent comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fb351c08e9cdcb522311735ab62441f00977b5c4
--- /dev/null
+++ b/chrome/test/functional/apptest.py
@@ -0,0 +1,38 @@
+# 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._ExpectEvent(event_id, 'init')
+ self._ExpectEvent(event_id, 'login ready')
+ driver.find_element_by_id('login').click()
+ self._ExpectEvent(event_id, 'login start')
+ self._ExpectEvent(event_id, 'login done')
+
+ def _ExpectEvent(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 True:
+ event = json.loads(self.GetNextEvent(event_id).get('name'))
+ if event.find('{') == -1:
+ break
+ self.assertEqual(event, event_name)
+
+
+if __name__ == '__main__':
+ pyauto_functional.Main()
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698