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

Unified Diff: tools/telemetry/telemetry/page/actions/action_runner_unittest.py

Issue 463013003: [telemetry] Reduce waits and timeouts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | tools/telemetry/telemetry/page/actions/play_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/action_runner_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/action_runner_unittest.py b/tools/telemetry/telemetry/page/actions/action_runner_unittest.py
index 4bcbb198b79a596d10fc5cf443ca939108766f98..96997c3352cd1c725c7ae4f0c1eb7e12c915252a 100644
--- a/tools/telemetry/telemetry/page/actions/action_runner_unittest.py
+++ b/tools/telemetry/telemetry/page/actions/action_runner_unittest.py
@@ -74,13 +74,13 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
self.Navigate('blank.html')
action_runner.ExecuteJavaScript(
- 'window.setTimeout(function() { window.testing = 101; }, 1000);')
- action_runner.Wait(2)
+ 'window.setTimeout(function() { window.testing = 101; }, 50);')
+ action_runner.Wait(0.1)
self.assertEqual(101, self._tab.EvaluateJavaScript('window.testing'))
action_runner.ExecuteJavaScript(
- 'window.setTimeout(function() { window.testing = 102; }, 2000);')
- action_runner.Wait(3)
+ 'window.setTimeout(function() { window.testing = 102; }, 100);')
+ action_runner.Wait(0.2)
self.assertEqual(102, self._tab.EvaluateJavaScript('window.testing'))
def testWaitForJavaScriptCondition(self):
@@ -89,11 +89,11 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
action_runner.ExecuteJavaScript('window.testing = 219;')
action_runner.WaitForJavaScriptCondition(
- 'window.testing == 219', timeout_in_seconds=1)
+ 'window.testing == 219', timeout_in_seconds=0.1)
action_runner.ExecuteJavaScript(
- 'window.setTimeout(function() { window.testing = 220; }, 1000);')
+ 'window.setTimeout(function() { window.testing = 220; }, 50);')
action_runner.WaitForJavaScriptCondition(
- 'window.testing == 220', timeout_in_seconds=2)
+ 'window.testing == 220', timeout_in_seconds=0.1)
self.assertEqual(220, self._tab.EvaluateJavaScript('window.testing'))
def testWaitForElement(self):
@@ -107,8 +107,8 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
' el.textContent = "foo";'
' document.body.appendChild(el);'
'})()')
- action_runner.WaitForElement('#test1', timeout_in_seconds=1)
- action_runner.WaitForElement(text='foo', timeout_in_seconds=1)
+ action_runner.WaitForElement('#test1', timeout_in_seconds=0.1)
+ action_runner.WaitForElement(text='foo', timeout_in_seconds=0.1)
action_runner.WaitForElement(
element_function='document.getElementById("test1")')
action_runner.ExecuteJavaScript(
@@ -116,19 +116,19 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
' var el = document.createElement("div");'
' el.id = "test2";'
' document.body.appendChild(el);'
- '}, 500)')
- action_runner.WaitForElement('#test2', timeout_in_seconds=2)
+ '}, 50)')
+ action_runner.WaitForElement('#test2', timeout_in_seconds=0.1)
action_runner.ExecuteJavaScript(
'window.setTimeout(function() {'
' document.getElementById("test2").textContent = "bar";'
- '}, 500)')
- action_runner.WaitForElement(text='bar', timeout_in_seconds=2)
+ '}, 50)')
+ action_runner.WaitForElement(text='bar', timeout_in_seconds=0.1)
action_runner.ExecuteJavaScript(
'window.setTimeout(function() {'
' var el = document.createElement("div");'
' el.id = "test3";'
' document.body.appendChild(el);'
- '}, 500)')
+ '}, 50)')
action_runner.WaitForElement(
element_function='document.getElementById("test3")')
@@ -143,9 +143,9 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
' el.textContent = "foo";'
' document.body.appendChild(el);'
'})()')
- action_runner.WaitForElement('#test1', timeout_in_seconds=1)
+ action_runner.WaitForElement('#test1', timeout_in_seconds=0.2)
def WaitForElement():
- action_runner.WaitForElement(text='oo', timeout_in_seconds=1)
+ action_runner.WaitForElement(text='oo', timeout_in_seconds=0.2)
self.assertRaises(util.TimeoutException, WaitForElement)
def testClickElement(self):
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/actions/play_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698