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

Side by Side Diff: chrome/test/functional/apptest.py

Issue 10168019: Adds an automation hook WaitUntilNavigationCompletes() which blocks until pending navigation comple… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a possible race condition. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import pyauto_functional # must be imported before pyauto 5 import pyauto_functional # must be imported before pyauto
6 import pyauto 6 import pyauto
7 7
8 class PyAutoEventsTest(pyauto.PyUITest): 8 class PyAutoEventsTest(pyauto.PyUITest):
9 """Tests using the event queue.""" 9 """Tests using the event queue."""
10 10
(...skipping 25 matching lines...) Expand all
36 self.NavigateToURL(url) 36 self.NavigateToURL(url)
37 self.GetNextEvent(self.AddDomMutationObserver('exists', '/html/body')) 37 self.GetNextEvent(self.AddDomMutationObserver('exists', '/html/body'))
38 self.GetNextEvent(self.AddDomMutationObserver('add', 'id("login")', 38 self.GetNextEvent(self.AddDomMutationObserver('add', 'id("login")',
39 expected_value='Log In')) 39 expected_value='Log In'))
40 success_id = self.AddDomMutationObserver('change', 'id("console")', 40 success_id = self.AddDomMutationObserver('change', 'id("console")',
41 expected_value='.*succeeded.*') 41 expected_value='.*succeeded.*')
42 self.NewWebDriver().find_element_by_id('login').click() 42 self.NewWebDriver().find_element_by_id('login').click()
43 self.GetNextEvent(self.AddDomMutationObserver('remove', 'id("fail")/a')) 43 self.GetNextEvent(self.AddDomMutationObserver('remove', 'id("fail")/a'))
44 self.GetNextEvent(success_id) 44 self.GetNextEvent(success_id)
45 45
46 def testWaitUntilNavigationCompletes(self):
47 """Basic test for WaitUntilNavigationCompletes."""
48 url = self.GetHttpURLForDataPath('apptest', 'dom_mutations.html')
49 js = """window.location.href = "%s";
50 window.domAutomationController.send("done");""" % url
51 self.ExecuteJavascript(js)
52 self.WaitUntilNavigationCompletes()
53 self.WaitForDomNode('id("login")')
54
46 def _ExpectEvent(self, event_id, expected_event_name): 55 def _ExpectEvent(self, event_id, expected_event_name):
47 """Checks that the next event is expected.""" 56 """Checks that the next event is expected."""
48 e = self.GetNextEvent(event_id) 57 e = self.GetNextEvent(event_id)
49 self.assertEqual(e.get('name'), expected_event_name, 58 self.assertEqual(e.get('name'), expected_event_name,
50 msg="unexpected event: %s" % e) 59 msg="unexpected event: %s" % e)
51 60
52 61
53 if __name__ == '__main__': 62 if __name__ == '__main__':
54 pyauto_functional.Main() 63 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698