| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 if (!chrome.omnibox) { | 2 if (!chrome.omnibox) { |
| 3 chrome.omnibox = chrome.experimental.omnibox; | 3 chrome.omnibox = chrome.experimental.omnibox; |
| 4 } | 4 } |
| 5 | 5 |
| 6 chrome.omnibox.onInputChanged.addListener( | 6 chrome.omnibox.onInputChanged.addListener( |
| 7 function(text, suggest) { | 7 function(text, suggest) { |
| 8 chrome.test.log("onInputChanged: " + text); | 8 chrome.test.log("onInputChanged: " + text); |
| 9 if (text != "suggestio") | 9 if (text != "suggestio") |
| 10 return; | 10 return; |
| 11 | 11 |
| 12 var desc = 'Description with style: <match> [dim], none'; | 12 var desc = 'Description with style: <match>, [dim], (url till end)'; |
| 13 suggest([ | 13 suggest([ |
| 14 { | 14 { |
| 15 content: text + "n1", | 15 content: text + "n1", |
| 16 description: desc, | 16 description: desc, |
| 17 descriptionStyles: [ | 17 descriptionStyles: [ |
| 18 chrome.omnibox.styleMatch(desc.indexOf('<'), 6), | 18 chrome.omnibox.styleMatch(desc.indexOf('<'), 6), |
| 19 chrome.omnibox.styleDim(desc.indexOf('['), 4), | 19 chrome.omnibox.styleDim(desc.indexOf('['), 4), |
| 20 chrome.omnibox.styleUrl(desc.indexOf('(')), |
| 20 ] | 21 ] |
| 21 }, | 22 }, |
| 22 {content: text + "n2", description: "description2"}, | 23 {content: text + "n2", description: "description2"}, |
| 23 {content: text + "n3", description: "description3"}, | 24 {content: text + "n3", description: "description3"}, |
| 24 ]); | 25 ]); |
| 25 }); | 26 }); |
| 26 | 27 |
| 27 chrome.omnibox.onInputEntered.addListener( | 28 chrome.omnibox.onInputEntered.addListener( |
| 28 function(text) { | 29 function(text) { |
| 29 chrome.test.assertEq("command", text); | 30 chrome.test.assertEq("command", text); |
| 30 chrome.test.notifyPass(); | 31 chrome.test.notifyPass(); |
| 31 }); | 32 }); |
| 32 | 33 |
| 33 // Now we wait for the input events to fire. | 34 // Now we wait for the input events to fire. |
| 34 chrome.test.notifyPass(); | 35 chrome.test.notifyPass(); |
| 35 </script> | 36 </script> |
| OLD | NEW |