Bug 1510693 - Tests for marionette's reftest runner r=jgraham,ato
authorGeoffrey Sneddon <me@gsnedders.com>
Fri, 11 Jan 2019 18:11:44 +0000
changeset 510615 ea7ab7f59caa6b655e117775a5816625acf7060a
parent 510614 0f68913927a57f85b9d575541f7c1aff77e27d00
child 510616 0655bfda512a0f795754f830dbe6a37e1f3bbbab
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]