Bug 1081959 - "Something went wrong" isn't displayed when the call fails in the connection phase, r=dmose

This commit is contained in:
Mark Banner 2014-10-20 11:10:23 -07:00
Родитель 040a900b8a
Коммит 85e3cfa6ad
6 изменённых файлов: 50 добавлений и 10 удалений

Просмотреть файл

@ -400,9 +400,12 @@ loop.conversation = (function(mozL10n) {
return;
}
if (progressData.reason === "timeout" &&
(previousState === "init" || previousState === "alerting")) {
if (progressData.reason === "timeout") {
if (previousState === "init" || previousState === "alerting") {
this._abortIncomingCall();
} else {
this.setState({callFailed: true, callStatus: "end"});
}
}
},

Просмотреть файл

@ -400,9 +400,12 @@ loop.conversation = (function(mozL10n) {
return;
}
if (progressData.reason === "timeout" &&
(previousState === "init" || previousState === "alerting")) {
if (progressData.reason === "timeout") {
if (previousState === "init" || previousState === "alerting") {
this._abortIncomingCall();
} else {
this.setState({callFailed: true, callStatus: "end"});
}
}
},

Просмотреть файл

@ -833,7 +833,9 @@ loop.webapp = (function($, _, OT, mozL10n) {
* Handles ending a call by resetting the view to the start state.
*/
_endCall: function() {
if (this.state.callStatus !== "failure") {
this.setState({callStatus: "end"});
}
},
});

Просмотреть файл

@ -833,7 +833,9 @@ loop.webapp = (function($, _, OT, mozL10n) {
* Handles ending a call by resetting the view to the start state.
*/
_endCall: function() {
if (this.state.callStatus !== "failure") {
this.setState({callStatus: "end"});
}
},
});

Просмотреть файл

@ -39,7 +39,7 @@ describe("loop.conversation", function() {
return "en-US";
},
setLoopCharPref: sinon.stub(),
getLoopCharPref: sinon.stub().returns(null),
getLoopCharPref: sinon.stub().returns("http://fakeurl"),
getLoopBoolPref: sinon.stub(),
getCallData: sinon.stub(),
releaseCallData: sinon.stub(),
@ -410,6 +410,8 @@ describe("loop.conversation", function() {
describe("WebSocket Events", function() {
describe("Call cancelled or timed out before acceptance", function() {
beforeEach(function() {
// Mounting the test component automatically calls the required
// setup functions
icView = mountTestComponent();
promise = new Promise(function(resolve, reject) {
resolve();
@ -539,6 +541,22 @@ describe("loop.conversation", function() {
});
});
});
describe("progress - terminated - timeout (previousState not init" +
" nor alerting)",
function() {
it("should set the state to end", function(done) {
promise.then(function() {
icView._websocket.trigger("progress", {
state: "terminated",
reason: "timeout"
}, "connecting");
expect(icView.state.callStatus).eql("end");
done();
});
});
});
});
});
});

Просмотреть файл

@ -308,12 +308,24 @@ describe("loop.webapp", function() {
});
describe("session:ended", function() {
it("should set display the StartConversationView", function() {
it("should display the StartConversationView", function() {
conversation.trigger("session:ended");
TestUtils.findRenderedComponentWithType(ocView,
loop.webapp.EndedConversationView);
});
it("should display the FailedConversationView if callStatus is failure",
function() {
ocView.setState({
callStatus: "failure"
});
conversation.trigger("session:ended");
var failedView = TestUtils.findRenderedComponentWithType(ocView,
loop.webapp.FailedConversationView);
expect(failedView).to.not.equal(null);
});
});
describe("session:peer-hungup", function() {