зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1038675 expiresAt parameter of /call-url/ response has changed from hours to seconds with the latest server version (Loop desktop client doesn't register on startup of browser). r=nperriault
This commit is contained in:
Родитель
54c330ca18
Коммит
972161bfff
|
@ -34,13 +34,6 @@ loop.Client = (function($) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Client.prototype = {
|
Client.prototype = {
|
||||||
/**
|
|
||||||
* Converts from hours to seconds
|
|
||||||
*/
|
|
||||||
_hoursToSeconds: function(value) {
|
|
||||||
return value * 60 * 60;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a data object to confirm it has the specified properties.
|
* Validates a data object to confirm it has the specified properties.
|
||||||
*
|
*
|
||||||
|
@ -124,8 +117,7 @@ loop.Client = (function($) {
|
||||||
|
|
||||||
cb(null, this._validate(urlData, expectedCallUrlProperties));
|
cb(null, this._validate(urlData, expectedCallUrlProperties));
|
||||||
|
|
||||||
var expiresHours = this._hoursToSeconds(urlData.expiresAt);
|
this.mozLoop.noteCallUrlExpiry(urlData.expiresAt);
|
||||||
this.mozLoop.noteCallUrlExpiry(expiresHours);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Error requesting call info", err);
|
console.log("Error requesting call info", err);
|
||||||
cb(err);
|
cb(err);
|
||||||
|
|
|
@ -91,7 +91,7 @@ describe("loop.Client", function() {
|
||||||
it("should note the call url expiry when the request succeeds", function() {
|
it("should note the call url expiry when the request succeeds", function() {
|
||||||
var callUrlData = {
|
var callUrlData = {
|
||||||
"callUrl": "fakeCallUrl",
|
"callUrl": "fakeCallUrl",
|
||||||
"expiresAt": 60
|
"expiresAt": 6000
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sets up the hawkRequest stub to trigger the callback with no error
|
// Sets up the hawkRequest stub to trigger the callback with no error
|
||||||
|
@ -101,10 +101,9 @@ describe("loop.Client", function() {
|
||||||
|
|
||||||
client.requestCallUrl("foo", callback);
|
client.requestCallUrl("foo", callback);
|
||||||
|
|
||||||
// expiresAt is in hours, and noteCallUrlExpiry wants seconds.
|
|
||||||
sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry);
|
sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry);
|
||||||
sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry,
|
sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry,
|
||||||
60 * 60 * 60);
|
6000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should send an error when the request fails", function() {
|
it("should send an error when the request fails", function() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче