1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/unit/test_autocomplete_stopSearch_no_throw.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/** 1.11 + * Added with bug 508102 to make sure that calling stopSearch on our 1.12 + * AutoComplete implementation does not throw. 1.13 + */ 1.14 + 1.15 +//////////////////////////////////////////////////////////////////////////////// 1.16 +//// Globals and Constants 1.17 + 1.18 +let hs = Cc["@mozilla.org/browser/nav-history-service;1"]. 1.19 + getService(Ci.nsINavHistoryService); 1.20 +let ac = Cc["@mozilla.org/autocomplete/search;1?name=history"]. 1.21 + getService(Ci.nsIAutoCompleteSearch); 1.22 + 1.23 +//////////////////////////////////////////////////////////////////////////////// 1.24 +//// Test Functions 1.25 + 1.26 +function test_stopSearch() 1.27 +{ 1.28 + try { 1.29 + ac.stopSearch(); 1.30 + } 1.31 + catch (e) { 1.32 + do_throw("we should not have caught anything!"); 1.33 + } 1.34 +} 1.35 + 1.36 +//////////////////////////////////////////////////////////////////////////////// 1.37 +//// Test Runner 1.38 + 1.39 +let tests = [ 1.40 + test_stopSearch, 1.41 +]; 1.42 +function run_test() 1.43 +{ 1.44 + tests.forEach(function(test) test()); 1.45 +}