mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1045643 Part 1 - Notify the Loop server when the desktop client accepts the call, so that it can update the call status. r=nperriault
This commit is contained in:
parent
df8b15570b
commit
e63272d14f
@ -240,6 +240,7 @@ loop.conversation = (function(OT, mozL10n) {
|
||||
*/
|
||||
accept: function() {
|
||||
navigator.mozLoop.stopAlerting();
|
||||
this._websocket.accept();
|
||||
this._conversation.incoming();
|
||||
},
|
||||
|
||||
|
@ -240,6 +240,7 @@ loop.conversation = (function(OT, mozL10n) {
|
||||
*/
|
||||
accept: function() {
|
||||
navigator.mozLoop.stopAlerting();
|
||||
this._websocket.accept();
|
||||
this._conversation.incoming();
|
||||
},
|
||||
|
||||
|
@ -127,6 +127,16 @@ loop.CallConnectionWebSocket = (function() {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Notifies the server that the user has accepted the call.
|
||||
*/
|
||||
accept: function() {
|
||||
this._send({
|
||||
messageType: "action",
|
||||
event: "accept"
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Sends data on the websocket.
|
||||
*
|
||||
|
@ -37,6 +37,7 @@ describe("loop.conversation", function() {
|
||||
},
|
||||
setLoopCharPref: sandbox.stub(),
|
||||
getLoopCharPref: sandbox.stub(),
|
||||
getLoopBoolPref: sandbox.stub(),
|
||||
startAlerting: function() {},
|
||||
stopAlerting: function() {},
|
||||
ensureRegistered: function() {},
|
||||
@ -311,14 +312,35 @@ describe("loop.conversation", function() {
|
||||
});
|
||||
|
||||
describe("#accept", function() {
|
||||
beforeEach(function() {
|
||||
conversation.setIncomingSessionData({
|
||||
sessionId: "sessionId",
|
||||
sessionToken: "sessionToken",
|
||||
apiKey: "apiKey",
|
||||
callType: "callType",
|
||||
callId: "Hello",
|
||||
progressURL: "http://progress.example.com",
|
||||
websocketToken: 123
|
||||
});
|
||||
router._setupWebSocketAndCallView();
|
||||
|
||||
sandbox.stub(router._websocket, "accept");
|
||||
sandbox.stub(navigator.mozLoop, "stopAlerting");
|
||||
});
|
||||
|
||||
it("should initiate the conversation", function() {
|
||||
router.accept();
|
||||
|
||||
sinon.assert.calledOnce(conversation.incoming);
|
||||
});
|
||||
|
||||
it("should notify the websocket of the user acceptance", function() {
|
||||
router.accept();
|
||||
|
||||
sinon.assert.calledOnce(router._websocket.accept);
|
||||
});
|
||||
|
||||
it("should stop alerting", function() {
|
||||
sandbox.stub(navigator.mozLoop, "stopAlerting");
|
||||
router.accept();
|
||||
|
||||
sinon.assert.calledOnce(navigator.mozLoop.stopAlerting);
|
||||
|
@ -148,6 +148,20 @@ describe("loop.CallConnectionWebSocket", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#accept", function() {
|
||||
it("should send an accept message to the server", function() {
|
||||
callWebSocket.promiseConnect();
|
||||
|
||||
callWebSocket.accept();
|
||||
|
||||
sinon.assert.calledOnce(dummySocket.send);
|
||||
sinon.assert.calledWithExactly(dummySocket.send, JSON.stringify({
|
||||
messageType: "action",
|
||||
event: "accept"
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe("Events", function() {
|
||||
beforeEach(function() {
|
||||
sandbox.stub(callWebSocket, "trigger");
|
||||
|
Loading…
Reference in New Issue
Block a user