From 229fe714c708934f2a4df1260604ce80bf6dbf4a Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Fri, 16 Apr 2010 23:50:40 +0200 Subject: [PATCH] Bug 527622 - test_sorting.js should wait for clear history. a=dietrich --- .../places/tests/queries/test_sorting.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/toolkit/components/places/tests/queries/test_sorting.js b/toolkit/components/places/tests/queries/test_sorting.js index f06db6760dc..96356715d2b 100644 --- a/toolkit/components/places/tests/queries/test_sorting.js +++ b/toolkit/components/places/tests/queries/test_sorting.js @@ -1214,10 +1214,14 @@ tests.push({ //////////////////////////////////////////////////////////////////////////////// -function prepare_for_next_test() { +function prepare_and_run_next_test(aTest) { + aTest.setup(); + aTest.check(); + // sorting reversed, usually SORT_BY have ASC and DESC + aTest.check_reverse(); // Execute cleanup tasks - PlacesUtils.bhistory.removeAllPages(); remove_all_bookmarks(); + waitForClearHistory(runNextTest); } /** @@ -1226,13 +1230,16 @@ function prepare_for_next_test() { * playing with the result set. */ function run_test() { - prepare_for_next_test(); - while (tests.length) { + do_test_pending(); + runNextTest(); +} + +function runNextTest() { + if (tests.length) { let test = tests.shift(); - test.setup(); - test.check(); - // sorting reversed, usually SORT_BY have ASC and DESC - test.check_reverse(); - prepare_for_next_test(); + prepare_and_run_next_test(test); + } + else { + do_test_finished(); } }