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

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

Issue 10828335: [pyauto] Fix ActionTimeoutChanger (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | « no previous file | 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/test_pyauto.py
diff --git a/chrome/test/functional/test_pyauto.py b/chrome/test/functional/test_pyauto.py
index acff46b6721d24ffb23b79eeb11d631d2357ee1b..74a2afbb56a6d03629827121e22f9907a85335c6 100755
--- a/chrome/test/functional/test_pyauto.py
+++ b/chrome/test/functional/test_pyauto.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import time
import unittest
import pyauto_functional # Must be imported before pyauto
@@ -50,6 +51,21 @@ class PyAutoTest(pyauto.PyUITest):
pyauto_errors.JSONInterfaceError,
lambda: self.GetNextEvent(timeout=2000)) # event queue is empty
+ def testActionTimeoutChanger(self):
+ """Verify that ActionTimeoutChanger works."""
+ new_timeout = 1000 # 1 sec
+ changer = pyauto.PyUITest.ActionTimeoutChanger(self, new_timeout)
+ self.assertEqual(self.action_timeout_ms(), new_timeout)
+
+ # Verify the amount of time taken for automation timeout
+ then = time.time()
+ self.assertRaises(
+ pyauto_errors.JSONInterfaceError,
+ lambda: self.ExecuteJavascript('invalid js should timeout'))
+ elapsed = time.time() - then
+ self.assertTrue(elapsed < new_timeout / 1000.0 + 2, # margin of 2 secs
+ msg='ActionTimeoutChanger did not work. '
+ 'Automation timeout took %f secs' % elapsed)
if __name__ == '__main__':
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698