Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
Bug 1274237 - Delay tab sharing startup until after AV start. r=Mardak
Browse files Browse the repository at this point in the history
  • Loading branch information
David Critchley authored and Standard8 committed Jun 28, 2016
1 parent 33c9dd6 commit eb47cd8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 42 deletions.
9 changes: 0 additions & 9 deletions add-on/panels/js/roomViews.jsx
Expand Up @@ -189,15 +189,6 @@ loop.roomViews = (function(mozL10n) {
})
}));
}

// Now that we're ready to share, automatically start sharing a tab only
// if we're not already connected to the room via the sdk, e.g. not in the
// case a remote participant just left.
if (nextState.roomState === ROOM_STATES.SESSION_CONNECTED &&
!(this.state.roomState === ROOM_STATES.SESSION_CONNECTED ||
this.state.roomState === ROOM_STATES.HAS_PARTICIPANTS)) {
this.props.dispatcher.dispatch(new sharedActions.StartBrowserShare());
}
},

/**
Expand Down
33 changes: 0 additions & 33 deletions add-on/panels/test/roomViews_test.js
Expand Up @@ -374,39 +374,6 @@ describe("loop.roomViews", function() {
}
}));
});

it("should dispatch a `StartBrowserShare` action when the SESSION_CONNECTED state is entered", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.READY });
mountTestComponent();

activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });

sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
new sharedActions.StartBrowserShare());
});

it("should not dispatch a `StartBrowserShare` action when the previous state was HAS_PARTICIPANTS", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.HAS_PARTICIPANTS });
mountTestComponent();

activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });

sinon.assert.notCalled(dispatcher.dispatch);
});

it("should not dispatch a `StartBrowserShare` action when the previous state was SESSION_CONNECTED", function() {
activeRoomStore.setStoreState({ roomState: ROOM_STATES.SESSION_CONNECTED });
mountTestComponent();

activeRoomStore.setStoreState({
roomState: ROOM_STATES.SESSION_CONNECTED,
// Additional change to force an update.
screenSharingState: "fake"
});

sinon.assert.notCalled(dispatcher.dispatch);
});
});

describe("#render", function() {
Expand Down
4 changes: 4 additions & 0 deletions shared/js/activeRoomStore.js
Expand Up @@ -782,6 +782,10 @@ loop.store.ActiveRoomStore = (function(mozL10n) {
remoteVideoEnabled: actionData.hasVideo,
remoteSrcMediaElement: actionData.srcMediaElement
});

if (this._isDesktop) {
this.startBrowserShare();
}
},

/**
Expand Down
18 changes: 18 additions & 0 deletions shared/test/activeRoomStore_test.js
Expand Up @@ -1339,6 +1339,24 @@ describe("loop.store.ActiveRoomStore", function() {
expect(store.getStoreState().remoteVideoEnabled).eql(true);
expect(store.getStoreState().remoteAudioEnabled).eql(true);
});

it("should call startBrowserShare when is desktop", function() {
sandbox.stub(store, "startBrowserShare");
store._isDesktop = true;
store.setStoreState({
localVideoEnabled: false,
remoteVideoEnabled: false
});

store.mediaStreamCreated(new sharedActions.MediaStreamCreated({
hasAudio: true,
hasVideo: true,
isLocal: false,
srcMediaElement: fakeStreamElement
}));

sinon.assert.calledOnce(store.startBrowserShare);
});
});

describe("#mediaStreamDestroyed", function() {
Expand Down

0 comments on commit eb47cd8

Please sign in to comment.