docshell/test/browser/browser_search_notification.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial