From 23c3bf8429ed0afa37302f1f9d1e3de48b30f069 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Tue, 11 Oct 2011 19:04:29 +0200 Subject: [PATCH] Bug 692496 - Fix a coherence error in a Sync test. r=philikon --- .../sync/tests/unit/test_history_store.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/services/sync/tests/unit/test_history_store.js b/services/sync/tests/unit/test_history_store.js index 9e50825c1306..df5967bd1f4b 100644 --- a/services/sync/tests/unit/test_history_store.js +++ b/services/sync/tests/unit/test_history_store.js @@ -163,11 +163,21 @@ add_test(function test_null_title() { add_test(function test_invalid_records() { _("Make sure we handle invalid URLs in places databases gracefully."); - let query = "INSERT INTO moz_places " - + "(url, title, rev_host, visit_count, last_visit_date) " - + "VALUES ('invalid-uri', 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")"; - let stmt = PlacesUtils.history.DBConnection.createAsyncStatement(query); - let result = Async.querySpinningly(stmt); + let stmt = PlacesUtils.history.DBConnection.createAsyncStatement( + "INSERT INTO moz_places " + + "(url, title, rev_host, visit_count, last_visit_date) " + + "VALUES ('invalid-uri', 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")" + ); + Async.querySpinningly(stmt); + stmt.finalize(); + // Add the corresponding visit to retain database coherence. + stmt = PlacesUtils.history.DBConnection.createAsyncStatement( + "INSERT INTO moz_historyvisits " + + "(place_id, visit_date, visit_type, session) " + + "VALUES ((SELECT id FROM moz_places WHERE url = 'invalid-uri'), " + + TIMESTAMP3 + ", " + Ci.nsINavHistoryService.TRANSITION_TYPED + ", 1)" + ); + Async.querySpinningly(stmt); stmt.finalize(); do_check_attribute_count(store.getAllIDs(), 4);