mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-29 11:57:55 +00:00
Backed out changeset 5548373ee88b (bug 1073732) for marionette test failures on a CLOSED TREE
This commit is contained in:
parent
b0bf38ca22
commit
4df4b9674d
@ -479,7 +479,6 @@ class Marionette(object):
|
||||
self.bin = bin
|
||||
self.instance = None
|
||||
self.session = None
|
||||
self.session_id = None
|
||||
self.window = None
|
||||
self.runner = None
|
||||
self.emulator = None
|
||||
@ -608,12 +607,12 @@ class Marionette(object):
|
||||
|
||||
@do_crash_check
|
||||
def _send_message(self, command, response_key="ok", **kwargs):
|
||||
if not self.session_id and command != "newSession":
|
||||
if not self.session and command != "newSession":
|
||||
raise errors.MarionetteException("Please start a session")
|
||||
|
||||
message = {"name": command}
|
||||
if self.session_id:
|
||||
message["sessionId"] = self.session_id
|
||||
if self.session:
|
||||
message["sessionId"] = self.session
|
||||
if kwargs:
|
||||
message["parameters"] = kwargs
|
||||
|
||||
@ -638,8 +637,6 @@ class Marionette(object):
|
||||
continue;
|
||||
|
||||
break;
|
||||
if not self.session_id:
|
||||
self.session_id = response.get("sessionId", None)
|
||||
|
||||
if response_key in response:
|
||||
return response[response_key]
|
||||
@ -814,7 +811,7 @@ class Marionette(object):
|
||||
'''
|
||||
return "%s%s" % (self.baseurl, relative_url)
|
||||
|
||||
def start_session(self, session_id=None, desired_capabilities=None):
|
||||
def start_session(self, desired_capabilities=None):
|
||||
"""Create a new Marionette session.
|
||||
|
||||
This method must be called before performing any other action.
|
||||
@ -823,7 +820,7 @@ class Marionette(object):
|
||||
capabilities. This is currently ignored.
|
||||
|
||||
:returns: A dict of the capabilities offered."""
|
||||
self.session = self._send_message('newSession', 'value', capabilities=desired_capabilities, session_id=session_id)
|
||||
self.session = self._send_message('newSession', 'value', capabilities=desired_capabilities)
|
||||
self.b2g = 'b2g' in self.session
|
||||
return self.session
|
||||
|
||||
@ -839,7 +836,6 @@ class Marionette(object):
|
||||
def delete_session(self):
|
||||
"""Close the current session and disconnect from the server."""
|
||||
response = self._send_message('deleteSession', 'ok')
|
||||
self.session_id = None
|
||||
self.session = None
|
||||
self.window = None
|
||||
self.client.close()
|
||||
|
@ -29,16 +29,4 @@ class TestSession(marionette_test.MarionetteTestCase):
|
||||
self.assertIn("takesScreenshot", caps)
|
||||
self.assertIn("version", caps)
|
||||
|
||||
def test_we_can_get_the_session_id(self):
|
||||
# Sends newSession
|
||||
caps = 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):
|
||||
# Sends newSession
|
||||
caps = self.marionette.start_session(session_id="ILoveCheese")
|
||||
|
||||
self.assertEqual(self.marionette.session_id, "ILoveCheese")
|
||||
self.assertTrue(isinstance(self.marionette.session_id, unicode))
|
@ -127,7 +127,6 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer)
|
||||
// passing back "actor ids" with responses. unlike the debugger server,
|
||||
// we don't have multiple actors, so just use a dummy value of "0" here
|
||||
this.actorID = "0";
|
||||
this.sessionId = null;
|
||||
|
||||
this.globalMessageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
@ -331,9 +330,7 @@ MarionetteServerConnection.prototype = {
|
||||
sendResponse: function MDA_sendResponse(value, command_id) {
|
||||
if (typeof(value) == 'undefined')
|
||||
value = null;
|
||||
this.sendToClient({from:this.actorID,
|
||||
sessionId: this.sessionId,
|
||||
value: value}, command_id);
|
||||
this.sendToClient({from:this.actorID, value: value}, command_id);
|
||||
},
|
||||
|
||||
sayHello: function MDA_sayHello() {
|
||||
@ -556,8 +553,6 @@ MarionetteServerConnection.prototype = {
|
||||
|
||||
this.scriptTimeout = 10000;
|
||||
if (aRequest && aRequest.parameters) {
|
||||
this.sessionId = aRequest.parameters.session_id ? aRequest.parameters.session_id : null;
|
||||
logger.info("Session Id is set to: " + this.sessionId);
|
||||
this.setSessionCapabilities(aRequest.parameters.capabilities);
|
||||
}
|
||||
|
||||
@ -630,10 +625,6 @@ MarionetteServerConnection.prototype = {
|
||||
getSessionCapabilities: function MDA_getSessionCapabilities() {
|
||||
this.command_id = this.getCommandId();
|
||||
|
||||
if (!this.sessionId) {
|
||||
this.sessionId = this.uuidGen.generateUUID().toString();
|
||||
}
|
||||
|
||||
// eideticker (bug 965297) and mochitest (bug 965304)
|
||||
// compatibility. They only check for the presence of this
|
||||
// property and should so not be in caps if not on a B2G device.
|
||||
@ -2286,7 +2277,6 @@ MarionetteServerConnection.prototype = {
|
||||
if (this.mainFrame) {
|
||||
this.mainFrame.focus();
|
||||
}
|
||||
this.sessionId = null;
|
||||
this.deleteFile('marionetteChromeScripts');
|
||||
this.deleteFile('marionetteContentScripts');
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user