author | Andreas Tolfsen <ato@mozilla.com> |
Thu, 02 Feb 2017 16:15:31 +0000 | |
changeset 341028 | 6d17a85df7e32778362ba54466d1a4a224f645b8 |
parent 341027 | ca0345ae33a42ffc2ec9f776c1a2fe1280d615e7 |
child 341029 | c4441c1492fd729592539121f7400e565e53b75e |
push id | 86615 |
push user | kwierso@gmail.com |
push date | Tue, 07 Feb 2017 01:52:08 +0000 |
treeherder | mozilla-inbound@f0453084d86e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | maja_zf |
bugs | 1336124 |
milestone | 54.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
|
--- a/testing/marionette/dispatcher.js +++ b/testing/marionette/dispatcher.js @@ -5,16 +5,17 @@ "use strict"; const {interfaces: Ci, utils: Cu} = Components; Cu.import("resource://gre/modules/Log.jsm"); Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Task.jsm"); +Cu.import("chrome://marionette/content/assert.js"); Cu.import("chrome://marionette/content/driver.js"); Cu.import("chrome://marionette/content/error.js"); Cu.import("chrome://marionette/content/message.js"); this.EXPORTED_SYMBOLS = ["Dispatcher"]; const PROTOCOL_VERSION = 3; @@ -115,16 +116,20 @@ Dispatcher.prototype.execute = function let sendError = resp.sendError.bind(resp); let req = Task.spawn(function*() { let fn = this.driver.commands[cmd.name]; if (typeof fn == "undefined") { throw new UnknownCommandError(cmd.name); } + if (cmd.name !== "newSession") { + assert.session(this.driver); + } + let rv = yield fn.bind(this.driver)(cmd, resp); if (typeof rv != "undefined") { if (typeof rv != "object") { resp.body = {value: rv}; } else { resp.body = rv; }
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_session.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_session.py @@ -1,13 +1,13 @@ # 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 marionette_driver.errors import SessionNotCreatedException +from marionette_driver import errors from marionette_harness import MarionetteTestCase class TestSession(MarionetteTestCase): def setUp(self): super(TestSession, self).setUp() self.marionette.delete_session() @@ -24,26 +24,33 @@ class TestSession(MarionetteTestCase): self.assertIn("browserName", caps) self.assertIn("browserVersion", caps) self.assertIn("platformName", caps) self.assertIn("platformVersion", caps) # Optional capabilities we want Marionette to support self.assertIn("rotatable", caps) - def test_we_can_get_the_session_id(self): + def test_get_session_id(self): # Sends newSession self.marionette.start_session() self.assertTrue(self.marionette.session_id is not None) self.assertTrue(isinstance(self.marionette.session_id, unicode)) - def test_we_can_set_the_session_id(self): + def test_set_the_session_id(self): # Sends newSession self.marionette.start_session(session_id="ILoveCheese") self.assertEqual(self.marionette.session_id, "ILoveCheese") self.assertTrue(isinstance(self.marionette.session_id, unicode)) - def test_we_only_support_one_active_session_at_a_time(self): + def test_session_already_started(self): self.marionette.start_session() self.assertTrue(isinstance(self.marionette.session_id, unicode)) - self.assertRaises(SessionNotCreatedException, self.marionette._send_message, "newSession", {}) + with self.assertRaises(errors.SessionNotCreatedException): + self.marionette._send_message("newSession", {}) + + def test_no_session(self): + with self.assertRaises(errors.InvalidSessionIdException): + self.marionette.get_url() + self.marionette.start_session() + self.marionette.get_url()