docshell/test/browser/browser_search_notification.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:ed70818f08b7
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 waitForExplicitFinish();
6
7 let tab = gBrowser.addTab();
8 gBrowser.selectedTab = tab;
9
10 function observer(subject, topic, data) {
11 Services.obs.removeObserver(observer, "keyword-search");
12 is(topic, "keyword-search", "Got keyword-search notification");
13
14 let engine = Services.search.defaultEngine;
15 ok(engine, "Have default search engine.");
16 is(engine, subject, "Notification subject is engine.");
17 is("firefox health report", data, "Notification data is search term.");
18
19 executeSoon(function cleanup() {
20 gBrowser.removeTab(tab);
21 finish();
22 });
23 }
24
25 Services.obs.addObserver(observer, "keyword-search", false);
26
27 gURLBar.value = "firefox health report";
28 gURLBar.handleCommand();
29 }
30

mercurial