Bug 1097733 - Enable Loop Rooms to be reused without reloading, by resetting the multiplex gum. r=nperriault

This commit is contained in:
Mark Banner 2014-11-13 15:33:16 +00:00
parent f8b3a3aaa8
commit 312adab51d
2 changed files with 32 additions and 1 deletions

View File

@ -364,6 +364,10 @@ loop.store.ActiveRoomStore = (function() {
* Switches to READY if undefined. * Switches to READY if undefined.
*/ */
_leaveRoom: function(nextState) { _leaveRoom: function(nextState) {
if (loop.standaloneMedia) {
loop.standaloneMedia.multiplexGum.reset();
}
this._sdkDriver.disconnectSession(); this._sdkDriver.disconnectSession();
if (this._timeout) { if (this._timeout) {

View File

@ -1,4 +1,4 @@
/* global chai */ /* global chai, loop */
var expect = chai.expect; var expect = chai.expect;
var sharedActions = loop.shared.actions; var sharedActions = loop.shared.actions;
@ -8,6 +8,7 @@ describe("loop.store.ActiveRoomStore", function () {
var ROOM_STATES = loop.store.ROOM_STATES; var ROOM_STATES = loop.store.ROOM_STATES;
var sandbox, dispatcher, store, fakeMozLoop, fakeSdkDriver; var sandbox, dispatcher, store, fakeMozLoop, fakeSdkDriver;
var fakeMultiplexGum;
beforeEach(function() { beforeEach(function() {
sandbox = sinon.sandbox.create(); sandbox = sinon.sandbox.create();
@ -30,6 +31,14 @@ describe("loop.store.ActiveRoomStore", function () {
disconnectSession: sandbox.stub() disconnectSession: sandbox.stub()
}; };
fakeMultiplexGum = {
reset: sandbox.spy()
};
loop.standaloneMedia = {
multiplexGum: fakeMultiplexGum
};
store = new loop.store.ActiveRoomStore({ store = new loop.store.ActiveRoomStore({
dispatcher: dispatcher, dispatcher: dispatcher,
mozLoop: fakeMozLoop, mozLoop: fakeMozLoop,
@ -379,6 +388,12 @@ describe("loop.store.ActiveRoomStore", function () {
}); });
}); });
it("should reset the multiplexGum", function() {
store.leaveRoom();
sinon.assert.calledOnce(fakeMultiplexGum.reset);
});
it("should disconnect from the servers via the sdk", function() { it("should disconnect from the servers via the sdk", function() {
store.connectionFailure(); store.connectionFailure();
@ -458,6 +473,12 @@ describe("loop.store.ActiveRoomStore", function () {
}); });
}); });
it("should reset the multiplexGum", function() {
store.leaveRoom();
sinon.assert.calledOnce(fakeMultiplexGum.reset);
});
it("should disconnect from the servers via the sdk", function() { it("should disconnect from the servers via the sdk", function() {
store.windowUnload(); store.windowUnload();
@ -497,6 +518,12 @@ describe("loop.store.ActiveRoomStore", function () {
}); });
}); });
it("should reset the multiplexGum", function() {
store.leaveRoom();
sinon.assert.calledOnce(fakeMultiplexGum.reset);
});
it("should disconnect from the servers via the sdk", function() { it("should disconnect from the servers via the sdk", function() {
store.leaveRoom(); store.leaveRoom();