Bug 1510693 - Tests for marionette's reftest runner r=jgraham,ato
☠☠ backed out by 3994da3447c3 ☠ ☠
authorGeoffrey Sneddon <me@gsnedders.com>
Thu, 10 Jan 2019 17:22:49 +0000
changeset 510413 bd2cb6b0a391056bd88a2e0d00577a80a3fef4fa
parent 510412 ab1bfb032425503fe0b2a4b9abd888e40882d2cc
child 510414 aa26fbe413c4039675a4d45bb83c73e8d4e9af5d
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham, ato
bugs1510693
milestone66.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 1510693 - Tests for marionette's reftest runner r=jgraham,ato Differential Revision: https://phabricator.services.mozilla.com/D13281
testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py
testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py
@@ -0,0 +1,47 @@
+# 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 __future__ import absolute_import, print_function
+
+from marionette_driver.errors import InvalidArgumentException, UnsupportedOperationException
+from marionette_harness import MarionetteTestCase
+
+
+class TestReftest(MarionetteTestCase):
+    def setUp(self):
+        super(TestReftest, self).setUp()
+
+        self.original_window = self.marionette.current_window_handle
+
+        self.marionette.set_context(self.marionette.CONTEXT_CHROME)
+        self.marionette.set_pref("dom.send_after_paint_to_content", True)
+
+    def tearDown(self):
+        try:
+            # make sure we've teared down any reftest context
+            self.marionette._send_message("reftest:teardown", {})
+        except UnsupportedOperationException:
+            # this will throw if we aren't currently in a reftest context
+            pass
+
+        self.marionette.switch_to_window(self.original_window)
+
+        self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
+        self.marionette.clear_pref("dom.send_after_paint_to_content")
+
+        super(TestReftest, self).tearDown()
+
+    def test_basic(self):
+        self.marionette._send_message("reftest:setup", {"screenshot": "unexpected"})
+        rv = self.marionette._send_message("reftest:run",
+                                           {"test": "about:blank",
+                                            "references": [["about:blank", [], "=="]],
+                                            "expected": "PASS",
+                                            "timeout": 10 * 1000})
+        self.marionette._send_message("reftest:teardown", {})
+        expected = {u'value': {u'extra': {},
+                               u'message': u'Testing about:blank == about:blank\n',
+                               u'stack': None,
+                               u'status': u'PASS'}}
+        self.assertEqual(expected, rv)
--- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
@@ -121,8 +121,10 @@ skip-if = appname == 'fennec'
 
 [test_addons.py]
 skip-if = appname == 'fennec' # Bug 1330598
 
 [test_select.py]
 [test_crash.py]
 skip-if = asan || manage_instance == false || appname == 'fennec' # Bug 1298921
 [test_localization.py]
+
+[test_reftest.py]