mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1166350 - Patch 2 - Fix tests. a=bustage
--HG-- extra : source : 726f0355ea94ba0772427bbebf53c2e919929d41
This commit is contained in:
parent
b8eea4d16b
commit
808595ef2e
@ -57,17 +57,20 @@ add_task(function* test_pushNotifications() {
|
||||
subscriptionUri: serverURL + '/pushNotifications/subscription1',
|
||||
pushEndpoint: serverURL + '/pushEndpoint1',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpoint1',
|
||||
scope: 'https://example.com/page/1'
|
||||
scope: 'https://example.com/page/1',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}, {
|
||||
subscriptionUri: serverURL + '/pushNotifications/subscription2',
|
||||
pushEndpoint: serverURL + '/pushEndpoint2',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpoint2',
|
||||
scope: 'https://example.com/page/2'
|
||||
scope: 'https://example.com/page/2',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}, {
|
||||
subscriptionUri: serverURL + '/pushNotifications/subscription3',
|
||||
pushEndpoint: serverURL + '/pushEndpoint3',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpoint3',
|
||||
scope: 'https://example.com/page/3'
|
||||
scope: 'https://example.com/page/3',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}];
|
||||
|
||||
for (let record of records) {
|
||||
|
@ -47,7 +47,8 @@ add_task(function* test_pushSubscriptionNoConnection() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Error");
|
||||
},
|
||||
@ -87,7 +88,8 @@ add_task(function* test_pushSubscriptionMissingLocation() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Return code 201, but the answer is bogus");
|
||||
},
|
||||
@ -113,7 +115,8 @@ add_task(function* test_pushSubscriptionMissingLink() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Return code 201, but the answer is bogus");
|
||||
},
|
||||
@ -139,7 +142,8 @@ add_task(function* test_pushSubscriptionMissingLink1() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Return code 201, but the answer is bogus");
|
||||
},
|
||||
@ -165,7 +169,8 @@ add_task(function* test_pushSubscriptionLocationBogus() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Return code 201, but URI is bogus.");
|
||||
},
|
||||
@ -191,7 +196,8 @@ add_task(function* test_pushSubscriptionNot2xxCode() {
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.register(
|
||||
'https://example.net/page/invalid-response'),
|
||||
'https://example.net/page/invalid-response',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error && error.includes("Error");
|
||||
},
|
||||
|
@ -57,7 +57,8 @@ add_task(function* test_pushSubscriptionSuccess() {
|
||||
});
|
||||
|
||||
let newRecord = yield PushNotificationService.register(
|
||||
'https://example.org/1'
|
||||
'https://example.org/1',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
);
|
||||
|
||||
var subscriptionUri = serverURL + '/pushSubscriptionSuccesss';
|
||||
@ -99,7 +100,8 @@ add_task(function* test_pushSubscriptionMissingLink2() {
|
||||
});
|
||||
|
||||
let newRecord = yield PushNotificationService.register(
|
||||
'https://example.org/no_receiptEndpoint'
|
||||
'https://example.org/no_receiptEndpoint',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
);
|
||||
|
||||
var subscriptionUri = serverURL + '/subscriptionMissingLink2';
|
||||
|
@ -25,7 +25,8 @@ add_task(function* test_registrations_error() {
|
||||
});
|
||||
|
||||
yield rejects(
|
||||
PushNotificationService.registration('https://example.net/1'),
|
||||
PushNotificationService.registration('https://example.net/1',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })),
|
||||
function(error) {
|
||||
return error == 'Database error';
|
||||
},
|
||||
|
@ -41,17 +41,20 @@ add_task(function* test_pushNotifications() {
|
||||
subscriptionUri: serverURL + '/subscriptionA',
|
||||
pushEndpoint: serverURL + '/pushEndpointA',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpointA',
|
||||
scope: 'https://example.net/a'
|
||||
scope: 'https://example.net/a',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}, {
|
||||
subscriptionUri: serverURL + '/subscriptionB',
|
||||
pushEndpoint: serverURL + '/pushEndpointB',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpointB',
|
||||
scope: 'https://example.net/b'
|
||||
scope: 'https://example.net/b',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}, {
|
||||
subscriptionUri: serverURL + '/subscriptionC',
|
||||
pushEndpoint: serverURL + '/pushEndpointC',
|
||||
pushReceiptEndpoint: serverURL + '/pushReceiptEndpointC',
|
||||
scope: 'https://example.net/c'
|
||||
scope: 'https://example.net/c',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false })
|
||||
}];
|
||||
|
||||
for (let record of records) {
|
||||
@ -64,7 +67,8 @@ add_task(function* test_pushNotifications() {
|
||||
});
|
||||
|
||||
let registration = yield PushNotificationService.registration(
|
||||
'https://example.net/a');
|
||||
'https://example.net/a',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false }));
|
||||
equal(
|
||||
registration.pushEndpoint,
|
||||
serverURL + '/pushEndpointA',
|
||||
|
@ -53,7 +53,8 @@ add_task(function* test_pushUnsubscriptionSuccess() {
|
||||
subscriptionUri: serverURL + '/subscriptionUnsubscriptionSuccess',
|
||||
pushEndpoint: serverURL + '/pushEndpointUnsubscriptionSuccess',
|
||||
pushReceiptEndpoint: serverURL + '/receiptPushEndpointUnsubscriptionSuccess',
|
||||
scope: 'https://example.com/page/unregister-success'
|
||||
scope: 'https://example.com/page/unregister-success',
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false }),
|
||||
});
|
||||
|
||||
PushService.init({
|
||||
@ -62,7 +63,8 @@ add_task(function* test_pushUnsubscriptionSuccess() {
|
||||
});
|
||||
|
||||
yield PushNotificationService.unregister(
|
||||
'https://example.com/page/unregister-success');
|
||||
'https://example.com/page/unregister-success',
|
||||
ChromeUtils.originAttributesToSuffix({ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inBrowser: false }));
|
||||
let record = yield db.getByKeyID(serverURL + '/subscriptionUnsubscriptionSuccess');
|
||||
ok(!record, 'Unregister did not remove record');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user