Bug 1105347 If something goes wrong in a Loop room, ensure that devices are released and the room is left fully. r=nperriault
This commit is contained in:
@@ -114,10 +114,11 @@ loop.store.ActiveRoomStore = (function() {
|
|||||||
|
|
||||||
this.setStoreState({
|
this.setStoreState({
|
||||||
error: actionData.error,
|
error: actionData.error,
|
||||||
failureReason: getReason(actionData.error.errno),
|
failureReason: getReason(actionData.error.errno)
|
||||||
roomState: actionData.error.errno === SERVER_CODES.ROOM_FULL ?
|
|
||||||
ROOM_STATES.FULL : ROOM_STATES.FAILED
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._leaveRoom(actionData.error.errno === SERVER_CODES.ROOM_FULL ?
|
||||||
|
ROOM_STATES.FULL : ROOM_STATES.FAILED);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||||||
fakeError = new Error("fake");
|
fakeError = new Error("fake");
|
||||||
|
|
||||||
store.setStoreState({
|
store.setStoreState({
|
||||||
roomState: ROOM_STATES.READY
|
roomState: ROOM_STATES.JOINED,
|
||||||
|
roomToken: "fakeToken",
|
||||||
|
sessionToken: "1627384950"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||||||
|
|
||||||
sinon.assert.calledOnce(console.error);
|
sinon.assert.calledOnce(console.error);
|
||||||
sinon.assert.calledWith(console.error,
|
sinon.assert.calledWith(console.error,
|
||||||
sinon.match(ROOM_STATES.READY), fakeError);
|
sinon.match(ROOM_STATES.JOINED), fakeError);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should set the state to `FULL` on server error room full", function() {
|
it("should set the state to `FULL` on server error room full", function() {
|
||||||
@@ -123,6 +125,35 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||||||
expect(store._storeState.roomState).eql(ROOM_STATES.FAILED);
|
expect(store._storeState.roomState).eql(ROOM_STATES.FAILED);
|
||||||
expect(store._storeState.failureReason).eql(FAILURE_REASONS.EXPIRED_OR_INVALID);
|
expect(store._storeState.failureReason).eql(FAILURE_REASONS.EXPIRED_OR_INVALID);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should reset the multiplexGum", function() {
|
||||||
|
store.roomFailure({error: fakeError});
|
||||||
|
|
||||||
|
sinon.assert.calledOnce(fakeMultiplexGum.reset);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should disconnect from the servers via the sdk", function() {
|
||||||
|
store.roomFailure({error: fakeError});
|
||||||
|
|
||||||
|
sinon.assert.calledOnce(fakeSdkDriver.disconnectSession);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should clear any existing timeout", function() {
|
||||||
|
sandbox.stub(window, "clearTimeout");
|
||||||
|
store._timeout = {};
|
||||||
|
|
||||||
|
store.roomFailure({error: fakeError});
|
||||||
|
|
||||||
|
sinon.assert.calledOnce(clearTimeout);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call mozLoop.rooms.leave", function() {
|
||||||
|
store.roomFailure({error: fakeError});
|
||||||
|
|
||||||
|
sinon.assert.calledOnce(fakeMozLoop.rooms.leave);
|
||||||
|
sinon.assert.calledWithExactly(fakeMozLoop.rooms.leave,
|
||||||
|
"fakeToken", "1627384950");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#setupWindowData", function() {
|
describe("#setupWindowData", function() {
|
||||||
@@ -584,7 +615,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should reset the multiplexGum", function() {
|
it("should reset the multiplexGum", function() {
|
||||||
store.leaveRoom();
|
store.windowUnload();
|
||||||
|
|
||||||
sinon.assert.calledOnce(fakeMultiplexGum.reset);
|
sinon.assert.calledOnce(fakeMultiplexGum.reset);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user