diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-06 15:14:54 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-06 15:14:54 +0100 |
commit | cc6a935ce54b573c1efd7533aff00e7bf0a9959c (patch) | |
tree | c8ad266edb7ea1e7b93aaaaa98847cf662373668 /services/sync/tests/unit/test_history_store.js | |
parent | d129c900c9f943adb69c1fb20ba1a029fdd95cff (diff) | |
parent | 9f4afc2552a67cc675b8b8af2ecb8ebc04a473a7 (diff) | |
download | UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.gz UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.lz UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.tar.xz UXP-cc6a935ce54b573c1efd7533aff00e7bf0a9959c.zip |
Merge branch 'master' into Pale_Moon-release
# Conflicts:
# application/palemoon/components/feeds/FeedWriter.js
# application/palemoon/config/version.txt
# security/manager/ssl/nsSTSPreloadList.errors
# security/manager/ssl/nsSTSPreloadList.inc
Diffstat (limited to 'services/sync/tests/unit/test_history_store.js')
-rw-r--r-- | services/sync/tests/unit/test_history_store.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/services/sync/tests/unit/test_history_store.js b/services/sync/tests/unit/test_history_store.js index 207b621e0..2381f103d 100644 --- a/services/sync/tests/unit/test_history_store.js +++ b/services/sync/tests/unit/test_history_store.js @@ -68,12 +68,12 @@ function ensureThrows(func) { }; } -var store = new HistoryEngine(Service)._store; +let store = new HistoryEngine(Service)._store; function applyEnsureNoFailures(records) { do_check_eq(store.applyIncomingBatch(records).length, 0); } -var fxuri, fxguid, tburi, tbguid; +let fxuri, fxguid, tburi, tbguid; function run_test() { initTestLogging("Trace"); @@ -189,8 +189,8 @@ add_test(function test_invalid_records() { .DBConnection; let stmt = connection.createAsyncStatement( "INSERT INTO moz_places " - + "(url, url_hash, title, rev_host, visit_count, last_visit_date) " - + "VALUES ('invalid-uri', hash('invalid-uri'), 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")" + + "(url, title, rev_host, visit_count, last_visit_date) " + + "VALUES ('invalid-uri', 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")" ); Async.querySpinningly(stmt); stmt.finalize(); @@ -198,7 +198,7 @@ add_test(function test_invalid_records() { stmt = connection.createAsyncStatement( "INSERT INTO moz_historyvisits " + "(place_id, visit_date, visit_type, session) " - + "VALUES ((SELECT id FROM moz_places WHERE url_hash = hash('invalid-uri') AND url = 'invalid-uri'), " + + "VALUES ((SELECT id FROM moz_places WHERE url = 'invalid-uri'), " + TIMESTAMP3 + ", " + Ci.nsINavHistoryService.TRANSITION_TYPED + ", 1)" ); Async.querySpinningly(stmt); @@ -226,7 +226,7 @@ add_test(function test_invalid_records() { type: Ci.nsINavHistoryService.TRANSITION_EMBED}]} ]); - _("Make sure we handle records with invalid visit codes or visit dates, gracefully ignoring those visits."); + _("Make sure we report records with invalid visits, gracefully handle non-integer dates."); let no_date_visit_guid = Utils.makeGUID(); let no_type_visit_guid = Utils.makeGUID(); let invalid_type_visit_guid = Utils.makeGUID(); @@ -235,11 +235,11 @@ add_test(function test_invalid_records() { {id: no_date_visit_guid, histUri: "http://no.date.visit/", title: "Visit has no date", - visits: [{type: Ci.nsINavHistoryService.TRANSITION_EMBED}]}, + visits: [{date: TIMESTAMP3}]}, {id: no_type_visit_guid, histUri: "http://no.type.visit/", title: "Visit has no type", - visits: [{date: TIMESTAMP3}]}, + visits: [{type: Ci.nsINavHistoryService.TRANSITION_EMBED}]}, {id: invalid_type_visit_guid, histUri: "http://invalid.type.visit/", title: "Visit has invalid type", @@ -251,7 +251,14 @@ add_test(function test_invalid_records() { visits: [{date: 1234.567, type: Ci.nsINavHistoryService.TRANSITION_EMBED}]} ]); - do_check_eq(failed.length, 0); + do_check_eq(failed.length, 3); + failed.sort(); + let expected = [no_date_visit_guid, + no_type_visit_guid, + invalid_type_visit_guid].sort(); + for (let i = 0; i < expected.length; i++) { + do_check_eq(failed[i], expected[i]); + } _("Make sure we handle records with javascript: URLs gracefully."); applyEnsureNoFailures([ |