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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     5  /**
     6   * Test preventive maintenance runTasks.
     7   */
     9 // Include PlacesDBUtils module.
    10 Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm");
    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 = [];
    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     });
    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);
    44     do_test_finished();
    45   });
    46 }

mercurial