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><match></match>, ' +
14 '<dim>[dim]</dim>, <url>(url till end)</url>';
16 {content
: text
+ "n1", description
: desc
},
17 {content
: text
+ "n2", description
: "description2"},
18 {content
: text
+ "n3" + incognitoSuffix
, description
: "description3"},
21 // Other tests, just provide a simple suggestion.
22 suggest([{content
: text
+ " 1", description
: "description"}]);
26 chrome
.omnibox
.onInputEntered
.addListener(
27 function(text
, disposition
) {
28 if (disposition
== "newForegroundTab") {
29 chrome
.test
.assertEq("newtab" + incognitoSuffix
, text
);
30 chrome
.test
.notifyPass();
32 chrome
.test
.assertEq("command" + incognitoSuffix
, text
);
33 chrome
.test
.notifyPass();
37 // Now we wait for the input events to fire.
38 chrome
.test
.notifyPass();