Bug 771224 - use chrome:// instead of loading remote xul. r=jgriffin
authorMalini Das <mdas@mozilla.com>
Thu, 12 Jul 2012 11:01:20 -0400
changeset 99071 ed4888197cb523d994b540a247ccc78347baf171
parent 99067 f0be4b70b814d6cd310667b309d2d80859aad71e
child 99072 b4183760a8130419b8a58399a5ba4a96b4d76f20
push id23102
push userryanvm@gmail.com
push dateFri, 13 Jul 2012 00:46:37 +0000
treeherdermozilla-central@6489be1890c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs771224
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 771224 - use chrome:// instead of loading remote xul. r=jgriffin
testing/marionette/Makefile.in
testing/marionette/client/marionette/chrome/test.xul
testing/marionette/client/marionette/chrome/test2.xul
testing/marionette/client/marionette/chrome/test_nested_iframe.xul
testing/marionette/client/marionette/geckoinstance.py
testing/marionette/client/marionette/tests/unit/test_click.py
testing/marionette/client/marionette/tests/unit/test_elementState.py
testing/marionette/client/marionette/tests/unit/test_findelement.py
testing/marionette/client/marionette/tests/unit/test_getattr.py
testing/marionette/client/marionette/tests/unit/test_selected.py
testing/marionette/client/marionette/tests/unit/test_switch_frame.py
testing/marionette/client/marionette/tests/unit/test_text.py
testing/marionette/client/marionette/www/test.xul
testing/marionette/client/marionette/www/test2.xul
testing/marionette/client/marionette/www/test_nested_iframe.xul
testing/marionette/jar.mn
--- a/testing/marionette/Makefile.in
+++ b/testing/marionette/Makefile.in
@@ -10,9 +10,13 @@ VPATH = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 ifdef ENABLE_MARIONETTE
     DIRS += components \
             atoms \
             $(NULL)
 endif
 
+ifdef ENABLE_TESTS
+    DEFINES += -DENABLE_TESTS
+endif
+
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/chrome/test.xul
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!-- 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/. -->
+
+<!DOCTYPE window [
+]>
+
+<dialog id="dia"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <vbox id="things">
+    <checkbox id="testBox"  label="box" />
+    <textbox id="textInput"  size="6" value="test" label="input" />
+    <textbox id="textInput2"  size="6" value="test" label="input" />
+    <textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
+  </vbox>
+     
+  <iframe id="iframe" name="iframename" src="chrome://marionette/content/test2.xul"/>
+  <iframe id="iframe" name="iframename" src="chrome://marionette/content/test_nested_iframe.xul"/>
+</dialog>
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/chrome/test2.xul
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!-- 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/. -->
+
+<!DOCTYPE window [
+]>
+
+<dialog id="dia"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <vbox id="things">
+    <checkbox id="testBox"  label="box" />
+    <textbox id="textInput"  size="6" value="test" label="input" />
+    <textbox id="textInput2"  size="6" value="test" label="input" />
+    <textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
+  </vbox>
+     
+</dialog>
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/chrome/test_nested_iframe.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- 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/. -->
+
+<!DOCTYPE window [
+]>
+
+  <iframe id="iframe" name="iframename" src="test2.xul"/>
+</dialog>
--- a/testing/marionette/client/marionette/geckoinstance.py
+++ b/testing/marionette/client/marionette/geckoinstance.py
@@ -15,18 +15,17 @@ class GeckoInstance(object):
         self.marionette_port = port
         self.bin = bin
         self.profile = profile
         self.runner = None
 
     def start(self):
         profile = self.profile
         if not profile:
-            prefs = {"dom.allow_XUL_XBL_for_file": True,
-                     "marionette.defaultPrefs.enabled": True,
+            prefs = {"marionette.defaultPrefs.enabled": True,
                      "marionette.defaultPrefs.port": 2828}
             profile = {"preferences": prefs, "restore":False}
         print "starting runner"
         self.runner = Runner.create(binary=self.bin, profile_args=profile, cmdargs=['-no-remote'])
         self.runner.start()
 
     def close(self):
         self.runner.stop()
--- a/testing/marionette/client/marionette/tests/unit/test_click.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click.py
@@ -19,22 +19,17 @@ class TestClick(MarionetteTestCase):
         self.marionette.find_element("link text", "333333").click()
         self.assertEqual(self.marionette.title, "XHTML Test Page")
 
 class TestClickChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_click(self):
         wins = self.marionette.get_windows()
--- a/testing/marionette/client/marionette/tests/unit/test_elementState.py
+++ b/testing/marionette/client/marionette/tests/unit/test_elementState.py
@@ -22,22 +22,17 @@ class TestState(MarionetteTestCase):
         self.marionette.execute_script("arguments[0].hidden = true;", [l])
         self.assertFalse(l.is_displayed())
 
 class TestStateChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_isEnabled(self):
         l = self.marionette.find_element("id", "textInput")
--- a/testing/marionette/client/marionette/tests/unit/test_findelement.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement.py
@@ -123,22 +123,17 @@ class TestElements(MarionetteTestCase):
         self.marionette.navigate(test_html)
         self.assertEqual(HTMLElement, type(self.marionette.find_element("id", "newDiv")))
 
 class TestElementsChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_id(self):
         el = self.marionette.execute_script("return window.document.getElementById('textInput');")
--- a/testing/marionette/client/marionette/tests/unit/test_getattr.py
+++ b/testing/marionette/client/marionette/tests/unit/test_getattr.py
@@ -12,22 +12,17 @@ class TestGetAttribute(MarionetteTestCas
         l = self.marionette.find_element("id", "mozLink")
         self.assertEqual("mozLink", l.get_attribute("id"))
 
 class TestGetAttributeChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_getAttribute(self):
         el = self.marionette.execute_script("return window.document.getElementById('textInput');")
--- a/testing/marionette/client/marionette/tests/unit/test_selected.py
+++ b/testing/marionette/client/marionette/tests/unit/test_selected.py
@@ -14,22 +14,17 @@ class TestSelected(MarionetteTestCase):
         box.click()
         self.assertTrue(box.selected())
 
 class TestSelectedChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_selected(self):
         wins = self.marionette.get_windows()
--- a/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
+++ b/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
@@ -32,22 +32,17 @@ class TestSwitchFrame(MarionetteTestCase
         #test that we're using the right window object server-side
         self.assertTrue("test_nested_iframe.html" in self.marionette.execute_script("return window.location.href;"))
 
 class TestSwitchFrameChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_switch_simple(self):
         self.assertTrue("test.xul" in self.marionette.get_url())
--- a/testing/marionette/client/marionette/tests/unit/test_text.py
+++ b/testing/marionette/client/marionette/tests/unit/test_text.py
@@ -28,22 +28,17 @@ class TestText(MarionetteTestCase):
         l.send_keys("o")
         self.assertEqual("asdfo", self.marionette.execute_script("return arguments[0].value;", [l]))
 
 class TestTextChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.get_window()
-        #need to get the file:// path for xul
-        unit = os.path.abspath(os.path.join(os.path.realpath(__file__), os.path.pardir))
-        tests = os.path.abspath(os.path.join(unit, os.path.pardir))
-        mpath = os.path.abspath(os.path.join(tests, os.path.pardir))
-        xul = "file://" + os.path.join(mpath, "www", "test.xul")
-        self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');")
+        self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');")
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_getText(self):
         wins = self.marionette.get_windows()
deleted file mode 100644
--- a/testing/marionette/client/marionette/www/test.xul
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!-- 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/. -->
-
-<!DOCTYPE window [
-]>
-
-<dialog id="dia"
-            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <vbox id="things">
-    <checkbox id="testBox"  label="box" />
-    <textbox id="textInput"  size="6" value="test" label="input" />
-    <textbox id="textInput2"  size="6" value="test" label="input" />
-    <textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
-  </vbox>
-     
-  <iframe id="iframe" name="iframename" src="test2.xul"/>
-  <iframe id="iframe" name="iframename" src="test_nested_iframe.xul"/>
-</dialog>
deleted file mode 100644
--- a/testing/marionette/client/marionette/www/test2.xul
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!-- 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/. -->
-
-<!DOCTYPE window [
-]>
-
-<dialog id="dia"
-            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <vbox id="things">
-    <checkbox id="testBox"  label="box" />
-    <textbox id="textInput"  size="6" value="test" label="input" />
-    <textbox id="textInput2"  size="6" value="test" label="input" />
-    <textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
-  </vbox>
-     
-</dialog>
deleted file mode 100644
--- a/testing/marionette/client/marionette/www/test_nested_iframe.xul
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<!-- 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/. -->
-
-<!DOCTYPE window [
-]>
-
-  <iframe id="iframe" name="iframename" src="test2.xul"/>
-</dialog>
--- a/testing/marionette/jar.mn
+++ b/testing/marionette/jar.mn
@@ -7,16 +7,21 @@ marionette.jar:
   content/marionette-actors.js      (marionette-actors.js)
   content/marionette-listener.js    (marionette-listener.js)
   content/marionette-elements.js    (marionette-elements.js)
   content/marionette-log-obj.js     (marionette-log-obj.js)
   content/marionette-simpletest.js  (marionette-simpletest.js)
   content/marionette-perf.js  (marionette-perf.js)
   content/EventUtils.js  (EventUtils.js)
   content/ChromeUtils.js  (ChromeUtils.js)
+#ifdef ENABLE_TESTS
+  content/test.xul  (client/marionette/chrome/test.xul)
+  content/test2.xul  (client/marionette/chrome/test2.xul)
+  content/test_nested_iframe.xul  (client/marionette/chrome/test_nested_iframe.xul)
+#endif
 
 % content specialpowers %content/
   content/specialpowers.js (../mochitest/specialpowers/content/specialpowers.js)
   content/SpecialPowersObserver.js (../mochitest/specialpowers/components/SpecialPowersObserver.js)
   content/specialpowersAPI.js (../mochitest/tests/SimpleTest/specialpowersAPI.js)
   content/SpecialPowersObserverAPI.js (../mochitest/tests/SimpleTest/SpecialPowersObserverAPI.js)
   content/ChromePowers.js (../mochitest/tests/SimpleTest/ChromePowers.js)
   content/MozillaLogger.js (../mochitest/tests/SimpleTest/MozillaLogger.js)