Bug 1353074 - Run globals execute script tests in all sandboxes; r=maja_zf draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:17:24 +0100
changeset 567665 7d9c0650fa1a57730962e3e919d1723dc6866f90
parent 567664 3983dfb2f14b740b100f4d8aa434b0e6a7e79e83
child 567666 9d0cbc8e4f20d351314a165cd9ef32a0f22131fa
push id55659
push userbmo:ato@mozilla.com
push dateTue, 25 Apr 2017 11:34:29 +0000
reviewersmaja_zf
bugs1353074
milestone55.0a1
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
testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
--- 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")