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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     7 // Get services.
     8 let os = Cc["@mozilla.org/observer-service;1"].
     9          getService(Ci.nsIObserverService);
    11 let gDummyCreated = false;
    12 let gDummyVisited = false;
    14 let observer = {
    15   observe: function(subject, topic, data) {
    16     if (topic == "dummy-observer-created")
    17       gDummyCreated = true;
    18     else if (topic == "dummy-observer-visited")
    19       gDummyVisited = true;
    20   },
    22   QueryInterface: XPCOMUtils.generateQI([
    23     Ci.nsIObserver,
    24     Ci.nsISupportsWeakReference,
    25   ])
    26 };
    28 function verify() {
    29   do_check_true(gDummyCreated);
    30   do_check_true(gDummyVisited);
    31   do_test_finished();
    32 }
    34 // main
    35 function run_test() {
    36   do_load_manifest("nsDummyObserver.manifest");
    38   os.addObserver(observer, "dummy-observer-created", true);
    39   os.addObserver(observer, "dummy-observer-visited", true);
    41   do_test_pending();
    43   // Add a visit
    44   promiseAddVisits(uri("http://typed.mozilla.org")).then(
    45             function () do_timeout(1000, verify));
    46 }

mercurial