diff options
Diffstat (limited to 'testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py')
-rw-r--r-- | testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py new file mode 100644 index 000000000..7e09451e4 --- /dev/null +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py @@ -0,0 +1,37 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from marionette_driver.errors import ScriptTimeoutException + +from marionette_harness import MarionetteTestCase + + +class TestExecuteIsolationContent(MarionetteTestCase): + def setUp(self): + super(TestExecuteIsolationContent, self).setUp() + self.content = True + + def test_execute_async_isolate(self): + # Results from one execute call that has timed out should not + # contaminate a future call. + multiplier = "*3" if self.content else "*1" + self.marionette.timeout.script = 0.5 + self.assertRaises(ScriptTimeoutException, + self.marionette.execute_async_script, + ("setTimeout(function() {{ marionetteScriptFinished(5{}); }}, 3000);" + .format(multiplier))) + + self.marionette.timeout.script = 6 + result = self.marionette.execute_async_script(""" + setTimeout(function() {{ marionetteScriptFinished(10{}); }}, 5000); + """.format(multiplier)) + self.assertEqual(result, 30 if self.content else 10) + +class TestExecuteIsolationChrome(TestExecuteIsolationContent): + def setUp(self): + super(TestExecuteIsolationChrome, self).setUp() + self.marionette.set_context("chrome") + self.content = False + + |