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

Side by Side Diff: chrome/test/data/instant_extended.html

Issue 12114050: [Instant] Instant Extended tests for search term extraction. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reupload Created 7 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/instant/instant_test_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script> 3 <script>
4 4
5 var apiHandle; 5 var apiHandle;
6 var onnativesuggestioncalls = 0; 6 var onnativesuggestioncalls = 0;
7 var onsubmitcalls = 0; 7 var onsubmitcalls = 0;
8 var suggestion;
8 9
9 function getApiHandle() { 10 function getApiHandle() {
10 if (window.navigator && window.navigator.searchBox) 11 if (window.navigator && window.navigator.searchBox)
11 return window.navigator.searchBox; 12 return window.navigator.searchBox;
12 if (window.chrome && window.chrome.searchBox) 13 if (window.chrome && window.chrome.searchBox)
13 return window.chrome.searchBox; 14 return window.chrome.searchBox;
14 return null; 15 return null;
15 } 16 }
16 17
17 function handleNativeSuggestions() { 18 function handleNativeSuggestions() {
18 onnativesuggestioncalls++; 19 onnativesuggestioncalls++;
19 apiHandle.show(2 /* QUERY_SUGGESTIONS */, 300); 20 // Showing the loader at 100% height.
21 apiHandle.show(2 /* QUERY_SUGGESTIONS */);
20 } 22 }
21 23
22 function handleSubmit() { 24 function handleSubmit() {
23 onsubmitcalls++; 25 onsubmitcalls++;
24 } 26 }
25 27
28 function handleOnChange() {
29 if (suggestion) {
30 apiHandle.setAutocompleteText(suggestion, 2);
31 // Ensure this is only called once for this suggestion.
32 suggestion = null;
33 }
34 }
35
26 function setUp() { 36 function setUp() {
27 apiHandle = getApiHandle(); 37 apiHandle = getApiHandle();
38 apiHandle.onchange = handleOnChange;
28 apiHandle.onnativesuggestions = handleNativeSuggestions; 39 apiHandle.onnativesuggestions = handleNativeSuggestions;
29 apiHandle.onsubmit = handleSubmit; 40 apiHandle.onsubmit = handleSubmit;
30 if (apiHandle.value) 41 if (apiHandle.value)
31 handleNativeSuggestions(); 42 handleNativeSuggestions();
32 } 43 }
33 44
34 setUp(); 45 setUp();
35 46
36 </script> 47 </script>
37 </head> 48 </head>
38 <body> 49 <body>
39 <h1>Instant</h1> 50 <h1>Instant</h1>
40 </body> 51 </body>
41 </html> 52 </html>
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698