Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / omnibox / test.js
blob325e22beaff8b432e5def0ba1358127b3c07083c
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var incognito = chrome.extension.inIncognitoContext;
6 var incognitoSuffix = incognito ? " incognito" : "";
8 chrome.omnibox.onInputChanged.addListener(
9 function(text, suggest) {
10 chrome.test.log("onInputChanged: " + text);
11 if (text == "suggestio") {
12 // First test, complete "suggestio"
13 var desc = 'Description with style: <match>&lt;match&gt;</match>, ' +
14 '<dim>[dim]</dim>, <url>(url till end)</url>';
15 suggest([
16 {content: text + "n1", description: desc},
17 {content: text + "n2", description: "description2"},
18 {content: text + "n3" + incognitoSuffix, description: "description3"},
19 ]);
20 } else {
21 // Other tests, just provide a simple suggestion.
22 suggest([{content: text + " 1", description: "description"}]);
24 });
26 chrome.omnibox.onInputEntered.addListener(
27 function(text, disposition) {
28 if (disposition == "newForegroundTab") {
29 chrome.test.assertEq("newtab" + incognitoSuffix, text);
30 chrome.test.notifyPass();
31 } else {
32 chrome.test.assertEq("command" + incognitoSuffix, text);
33 chrome.test.notifyPass();
35 });
37 // Now we wait for the input events to fire.
38 chrome.test.notifyPass();