Closed Bug 458810 Opened 16 years ago Closed 4 years ago

Implement search service test suite

Categories

(Firefox :: Search, defect, P4)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1120642

People

(Reporter: rflint, Unassigned)

References

Details

(Whiteboard: [fxsearch])

Attachments

(2 files, 1 obsolete file)

      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]
Rank: 35
Priority: P3 → P4

I think the test sections here are covered, if they're not, then bug 1120642 will definitely cover them. Duping to that as it is clearer.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: