docshell/test/browser/browser_search_notification.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     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