michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: * Test preventive maintenance runTasks. michael@0: */ michael@0: michael@0: // Include PlacesDBUtils module. michael@0: Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm"); michael@0: michael@0: function run_test() { michael@0: do_test_pending(); michael@0: PlacesDBUtils.runTasks([PlacesDBUtils.reindex], function(aLog) { michael@0: let sections = []; michael@0: let positives = []; michael@0: let negatives = []; michael@0: let infos = []; michael@0: michael@0: aLog.forEach(function (aMsg) { michael@0: print (aMsg); michael@0: switch (aMsg.substr(0, 1)) { michael@0: case "+": michael@0: positives.push(aMsg); michael@0: break; michael@0: case "-": michael@0: negatives.push(aMsg); michael@0: break; michael@0: case ">": michael@0: sections.push(aMsg); michael@0: break; michael@0: default: michael@0: infos.push(aMsg); michael@0: } michael@0: }); michael@0: michael@0: print("Check that we have run all sections."); michael@0: do_check_eq(sections.length, 1); michael@0: print("Check that we have no negatives."); michael@0: do_check_false(!!negatives.length); michael@0: print("Check that we have positives."); michael@0: do_check_true(!!positives.length); michael@0: michael@0: do_test_finished(); michael@0: }); michael@0: }