blob: d60e2c062eef3f471b1f5ec8ddd47b8cd7bdceae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# 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() {{ arguments[0](5{}); }}, 3000);".format(
multiplier
)
),
)
self.marionette.timeout.script = 6
result = self.marionette.execute_async_script(
"""
let [resolve] = arguments;
setTimeout(function() {{ resolve(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
|