Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Unified Diff: chrome/test/data/instant_extended.js

Issue 11592004: InstantExtended: tests! (Closed) Base URL: http://git.chromium.org/chromium/src.git@fixmyterms
Patch Set: Dont have a testing mode. Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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');
+ 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();

Powered by Google App Engine
This is Rietveld 408576698