docshell/test/browser/browser_search_notification.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   waitForExplicitFinish();
     7   let tab = gBrowser.addTab();
     8   gBrowser.selectedTab = tab;
    10   function observer(subject, topic, data) {
    11     Services.obs.removeObserver(observer, "keyword-search");
    12     is(topic, "keyword-search", "Got keyword-search notification");
    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.");
    19     executeSoon(function cleanup() {
    20       gBrowser.removeTab(tab);
    21       finish();
    22     });
    23   }
    25   Services.obs.addObserver(observer, "keyword-search", false);
    27   gURLBar.value = "firefox health report";
    28   gURLBar.handleCommand();
    29 }

mercurial