Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * What this is aimed to test: |
michael@0 | 9 | * |
michael@0 | 10 | * Ensure that History (through category cache) notifies us just once. |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | let os = Cc["@mozilla.org/observer-service;1"]. |
michael@0 | 14 | getService(Ci.nsIObserverService); |
michael@0 | 15 | let hs = Cc["@mozilla.org/browser/nav-history-service;1"]. |
michael@0 | 16 | getService(Ci.nsINavHistoryService); |
michael@0 | 17 | |
michael@0 | 18 | let gObserver = { |
michael@0 | 19 | notifications: 0, |
michael@0 | 20 | observe: function(aSubject, aTopic, aData) { |
michael@0 | 21 | this.notifications++; |
michael@0 | 22 | } |
michael@0 | 23 | }; |
michael@0 | 24 | os.addObserver(gObserver, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false); |
michael@0 | 25 | |
michael@0 | 26 | function run_test() { |
michael@0 | 27 | // Set interval to a large value so we don't expire on it. |
michael@0 | 28 | setInterval(3600); // 1h |
michael@0 | 29 | |
michael@0 | 30 | hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages(); |
michael@0 | 31 | |
michael@0 | 32 | do_timeout(2000, check_result); |
michael@0 | 33 | do_test_pending(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function check_result() { |
michael@0 | 37 | os.removeObserver(gObserver, PlacesUtils.TOPIC_EXPIRATION_FINISHED); |
michael@0 | 38 | do_check_eq(gObserver.notifications, 1); |
michael@0 | 39 | do_test_finished(); |
michael@0 | 40 | } |