Bug 1159310 - Update the storage xpcshell tests. r=dougt

This commit is contained in:
Kit Cambridge 2015-04-29 05:31:00 -04:00
parent 60e1c95475
commit bead71165e
2 changed files with 21 additions and 5 deletions

View File

@ -105,5 +105,19 @@ add_task(function* test_notification_incomplete() {
let storeRecords = yield promiseDB.getAllChannelIDs();
storeRecords.sort(({pushEndpoint: a}, {pushEndpoint: b}) =>
compareAscending(a, b));
deepEqual(records, storeRecords, 'Should not update malformed records');
recordsAreEqual(records, storeRecords);
});
function recordIsEqual(a, b) {
strictEqual(a.channelID, b.channelID, 'Wrong channel ID in record');
strictEqual(a.pushEndpoint, b.pushEndpoint, 'Wrong push endpoint in record');
strictEqual(a.scope, b.scope, 'Wrong scope in record');
strictEqual(a.version, b.version, 'Wrong version in record');
}
function recordsAreEqual(a, b) {
equal(a.length, b.length, 'Mismatched record count');
for (let i = 0; i < a.length; i++) {
recordIsEqual(a[i], b[i]);
}
}

View File

@ -60,8 +60,10 @@ add_task(function* test_registration_success() {
let registration = yield PushNotificationService.registration(
'https://example.net/a');
deepEqual(registration, {
pushEndpoint: 'https://example.com/update/same-manifest/1',
version: 5
}, 'Should include registrations for all pages with this manifest');
equal(
registration.pushEndpoint,
'https://example.com/update/same-manifest/1',
'Wrong push endpoint for scope'
);
equal(registration.version, 5, 'Wrong version for scope');
});