toolkit/components/places/tests/unit/test_preventive_maintenance_runTasks.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:abe6d204fd90
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 /**
6 * Test preventive maintenance runTasks.
7 */
8
9 // Include PlacesDBUtils module.
10 Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm");
11
12 function run_test() {
13 do_test_pending();
14 PlacesDBUtils.runTasks([PlacesDBUtils.reindex], function(aLog) {
15 let sections = [];
16 let positives = [];
17 let negatives = [];
18 let infos = [];
19
20 aLog.forEach(function (aMsg) {
21 print (aMsg);
22 switch (aMsg.substr(0, 1)) {
23 case "+":
24 positives.push(aMsg);
25 break;
26 case "-":
27 negatives.push(aMsg);
28 break;
29 case ">":
30 sections.push(aMsg);
31 break;
32 default:
33 infos.push(aMsg);
34 }
35 });
36
37 print("Check that we have run all sections.");
38 do_check_eq(sections.length, 1);
39 print("Check that we have no negatives.");
40 do_check_false(!!negatives.length);
41 print("Check that we have positives.");
42 do_check_true(!!positives.length);
43
44 do_test_finished();
45 });
46 }

mercurial