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 555144 79f6eb114c091fc018042ff6f440d8bdb7e7edd3
parent 555143 d629b966998bde20e52a992ed326af2de79485aa
child 555145 64bee670a6ff0c887c2a02b7b23d7db73d705723
push id52171
push userbmo:ato@mozilla.com
push dateMon, 03 Apr 2017 18:22:15 +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")