Index: chrome/test/data/instant_extended.js |
diff --git a/chrome/test/data/instant_extended.js b/chrome/test/data/instant_extended.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..015f7367edbf815d29ffe5da2d7677a9f3eb041c |
--- /dev/null |
+++ b/chrome/test/data/instant_extended.js |
@@ -0,0 +1,35 @@ |
+/** |
+ * @fileoverview Embedded Search API implementation for testing. |
+ */ |
+ |
+var apiHandle; |
+var onnativesuggestioncalls = 0; |
+var onsubmitcalls = 0; |
+ |
+function getApiHandle() { |
+ if (window.navigator && window.navigator.searchBox) |
+ return window.navigator.searchBox; |
+ if (window.chrome && window.chrome.searchBox) |
+ return window.chrome.searchBox; |
+ return null; |
+} |
+ |
+function handleNativeSuggestions() { |
+ console.log('native'); |
sreeram
2013/01/17 23:54:18
Remove this? (I assume you added it for debugging.
samarth
2013/01/18 00:06:45
Done.
|
+ onnativesuggestioncalls++; |
+ apiHandle.show(2 /* QUERY_SUGGESTIONS */, 300); |
+} |
+ |
+function handleSubmit() { |
+ onsubmitcalls++; |
+} |
+ |
+function setUp() { |
+ apiHandle = getApiHandle(); |
+ apiHandle.onnativesuggestions = handleNativeSuggestions; |
+ apiHandle.onsubmit = handleSubmit; |
+ if (apiHandle.value) |
+ handleNativeSuggestions(); |
+} |
+ |
+setUp(); |