Bug 1353074 - Run globals execute script tests in all sandboxes; r=maja_zf
We accidentally only ran them in "default" and "system" before, and also
one of the arguments in the system globals test was wrong.
MozReview-Commit-ID: DmBYGsZaIVP
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
@@ -121,27 +121,38 @@ class TestExecuteContent(MarionetteTestC
def test_argument_array(self):
self.assertEqual(
[1, 2], self.marionette.execute_script("return arguments[0]", ([1, 2],)))
def test_argument_object(self):
self.assertEqual({"foo": 1}, self.marionette.execute_script(
"return arguments[0]", ({"foo": 1},)))
- def test_globals(self):
+ def test_default_sandbox_globals(self):
for property in globals:
- self.assert_is_defined(property)
+ self.assert_is_defined(property, sandbox="default")
+
self.assert_is_defined("Components")
self.assert_is_defined("window.wrappedJSObject")
def test_system_globals(self):
for property in globals:
self.assert_is_defined(property, sandbox="system")
+
self.assert_is_defined("Components", sandbox="system")
- self.assert_is_defined("window.wrappedJSObject")
+ self.assert_is_defined("window.wrappedJSObject", sandbox="system")
+
+ def test_mutable_sandbox_globals(self):
+ for property in globals:
+ self.assert_is_defined(property, sandbox=None)
+
+ # Components is there, but will be removed soon
+ self.assert_is_defined("Components", sandbox=None)
+ # wrappedJSObject is always there in sandboxes
+ self.assert_is_defined("window.wrappedJSObject", sandbox=None)
def test_exception(self):
self.assertRaises(errors.JavascriptException,
self.marionette.execute_script, "return foo")
def test_stacktrace(self):
with self.assertRaises(errors.JavascriptException) as cm:
self.marionette.execute_script("return b")