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 f9172ab1e5
commit 1acb816b45
2 changed files with 32 additions and 1 deletions

View File

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

View File

@ -1,4 +1,4 @@
/* global chai */
/* global chai, loop */
var expect = chai.expect;
var sharedActions = loop.shared.actions;
@ -8,6 +8,7 @@ describe("loop.store.ActiveRoomStore", function () {
var ROOM_STATES = loop.store.ROOM_STATES;
var sandbox, dispatcher, store, fakeMozLoop, fakeSdkDriver;
var fakeMultiplexGum;
beforeEach(function() {
sandbox = sinon.sandbox.create();
@ -30,6 +31,14 @@ describe("loop.store.ActiveRoomStore", function () {
disconnectSession: sandbox.stub()
};
fakeMultiplexGum = {
reset: sandbox.spy()
};
loop.standaloneMedia = {
multiplexGum: fakeMultiplexGum
};
store = new loop.store.ActiveRoomStore({
dispatcher: dispatcher,
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() {
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() {
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() {
store.leaveRoom();