mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 707945 followup - Fix random failure in test_421180.js by making it properly wait for asynchronous database operations.
This commit is contained in:
parent
e412e07a3c
commit
72b1808a9e
@ -56,8 +56,7 @@ catch(ex) {
|
||||
do_throw("Could not get database connection\n");
|
||||
}
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
add_test(function test_keywordRemovedOnUniqueItemRemoval() {
|
||||
var bookmarkedURI = uri("http://foo.bar");
|
||||
var keyword = "testkeyword";
|
||||
|
||||
@ -74,12 +73,22 @@ function run_test() {
|
||||
// remove bookmark
|
||||
bmsvc.removeItem(bookmarkId);
|
||||
|
||||
// check that keyword has been removed
|
||||
var sql = "SELECT id FROM moz_keywords WHERE keyword = ?1";
|
||||
var stmt = mDBConn.createStatement(sql);
|
||||
stmt.bindByIndex(0, keyword);
|
||||
do_check_false(stmt.executeStep());
|
||||
stmt.finalize();
|
||||
waitForAsyncUpdates(function() {
|
||||
// Check that keyword has been removed from the database.
|
||||
// The removal is asynchronous.
|
||||
var sql = "SELECT id FROM moz_keywords WHERE keyword = ?1";
|
||||
var stmt = mDBConn.createStatement(sql);
|
||||
stmt.bindByIndex(0, keyword);
|
||||
do_check_false(stmt.executeStep());
|
||||
stmt.finalize();
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
||||
add_test(function test_keywordNotRemovedOnNonUniqueItemRemoval() {
|
||||
var bookmarkedURI = uri("http://foo.bar");
|
||||
var keyword = "testkeyword";
|
||||
|
||||
// TEST 2
|
||||
// 1. add 2 bookmarks
|
||||
@ -101,10 +110,18 @@ function run_test() {
|
||||
// remove first bookmark
|
||||
bmsvc.removeItem(bookmarkId1);
|
||||
|
||||
// check that keyword is still there
|
||||
var sql = "SELECT id FROM moz_keywords WHERE keyword = ?1";
|
||||
var stmt = mDBConn.createStatement(sql);
|
||||
stmt.bindByIndex(0, keyword);
|
||||
do_check_true(stmt.executeStep());
|
||||
stmt.finalize();
|
||||
waitForAsyncUpdates(function() {
|
||||
// check that keyword is still there
|
||||
var sql = "SELECT id FROM moz_keywords WHERE keyword = ?1";
|
||||
var stmt = mDBConn.createStatement(sql);
|
||||
stmt.bindByIndex(0, keyword);
|
||||
do_check_true(stmt.executeStep());
|
||||
stmt.finalize();
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user