From fb8ad5dbce049b1c5b19b74d95293feb02187608 Mon Sep 17 00:00:00 2001 From: Kit Cambridge Date: Wed, 29 Apr 2015 05:31:00 -0400 Subject: [PATCH] Bug 1159310 - Update the storage xpcshell tests. r=dougt --HG-- extra : rebase_source : 3a49ed7f897c4edda9a2b84e4bd9f5f31777d3e2 --- .../xpcshell/test_notification_incomplete.js | 16 +++++++++++++++- .../test/xpcshell/test_registration_success.js | 10 ++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dom/push/test/xpcshell/test_notification_incomplete.js b/dom/push/test/xpcshell/test_notification_incomplete.js index b7f065f5ac6e..26c11f59a97b 100644 --- a/dom/push/test/xpcshell/test_notification_incomplete.js +++ b/dom/push/test/xpcshell/test_notification_incomplete.js @@ -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]); + } +} diff --git a/dom/push/test/xpcshell/test_registration_success.js b/dom/push/test/xpcshell/test_registration_success.js index b3c03e730e2e..738828c51b89 100644 --- a/dom/push/test/xpcshell/test_registration_success.js +++ b/dom/push/test/xpcshell/test_registration_success.js @@ -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'); });