Implement search service test suite

NEW
Unassigned

Status

()

defect
P4
normal
Rank:
35
11 years ago
3 years ago

People

(Reporter: rflint, Unassigned)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fxsearch])

Attachments

(2 attachments, 1 obsolete attachment)

No description provided.
Priority: -- → P1
Target Milestone: Firefox 3.1b2 → Firefox 3.1b3
Attachment #577983 - Flags: review?(gavin.bugzilla) → review?(gavin.sharp)
Comment on attachment 577983 [details] [diff] [review]
One more test. Covering: asynchronous initialization, observer notification, downloading and installing sherlock, downloading and installing opensearch.

>diff --git a/toolkit/components/search/tests/xpcshell/test_645970.js b/toolkit/components/search/tests/xpcshell/test_645970.js

>+  do_timeout(1000, function() {
>+      do_throw("timeout");
>+    })

Is this really necessary? The test harness should be taking care of this... (also applies to the other test)

>diff --git a/toolkit/components/search/tests/xpcshell/test_downloadAndAddEngine.js b/toolkit/components/search/tests/xpcshell/test_downloadAndAddEngine.js

>+/* ***** BEGIN LICENSE BLOCK *****

You should generally use the PD license for new tests, where possible (see https://www.mozilla.org/MPL/headers/ ).

>+Components.utils.import("resource://gre/modules/Services.jsm");
>+var gPrefService = Cc["@mozilla.org/preferences-service;1"]
>+                    .getService(Ci.nsIPrefService)
>+                    .QueryInterface(Ci.nsIPrefBranch);

Services.prefs

>+function setTimeout(aCallback, aDelay) {
>+	var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
>+  timer.initWithCallback(new TimerCallback(aCallback), aDelay, timer.TYPE_ONE_SHOT);
>+}

You can pass aCallback to initWithCallback directly, no need for TimerCallback.

>+const files = [

Unused?

>+var IOService = Components.classes["@mozilla.org/network/io-service;1"]
>+                .getService(Components.interfaces.nsIIOService);

Services.io

>+function getResponse(aSet) {

Also seems to be unused?

>+function run_test() {

>+  // The search service needs to be started after the jarURIs pref has been
>+  // set in order to initiate it correctly
>+  let searchService = Cc["@mozilla.org/browser/search-service;1"]
>+                       .getService(Ci.nsIBrowserSearchService);

Services.search

>+  var observerService = Cc["@mozilla.org/observer-service;1"]
>+    .getService(Ci.nsIObserverService);

Services.obs

>+  var observer = { observe: function(aSubject, aTopic, aData) {
 
function observer(aSubject, aTopic, aData) {
}

More tests are great, thanks for this!
Attachment #577983 - Flags: review?(gavin.sharp) → feedback+
David, do you think you'll have time to work on another version anytime soon?  If not, it's something I'd be interested in finishing up since I'm working on some other search bugs.
Assignee: rflint → nobody
Status: ASSIGNED → NEW
Target Milestone: Firefox 3.1b3 → ---
(In reply to Matthew N. [:MattN] from comment #4)
> David, do you think you'll have time to work on another version anytime
> soon?  If not, it's something I'd be interested in finishing up since I'm
> working on some other search bugs.

Yes, I have a few tests, waiting for bug 699856.
We have a bunch of search service tests now. Is this bug still tracking something useful?
The search service deserves more test, but that's probably not a bug.
it's unclear if this is adding tests that are currently missing
Priority: P1 → P3
Whiteboard: [fxsearch]

Updated

4 years ago
Rank: 35
Priority: P3 → P4
You need to log in before you can comment on or make changes to this bug.