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

Unified Diff: trunk/src/chrome/test/data/instant_extended_ntp.html

Issue 135903002: Revert 244407 "InstantExtended: remove dead code related to the ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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
« no previous file with comments | « trunk/src/chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/test/data/instant_extended_ntp.html
===================================================================
--- trunk/src/chrome/test/data/instant_extended_ntp.html (revision 244428)
+++ trunk/src/chrome/test/data/instant_extended_ntp.html (working copy)
@@ -1,165 +0,0 @@
-<html>
- <head>
- <script>
-
-var apiHandle;
-var newTabPageHandle;
-var savedUserText = null;
-var suggestionIndex = -1;
-var suggestions = ["result 1", "result 2", "http://www.google.com"];
-var suggestion;
-var suggestionType = 0; // INSTANT_SUGGESTION_SEARCH
-var behavior = 2; // INSTANT_COMPLETE_NEVER
-var onMostVisitedChangedCalls = 0;
-var mostVisitedItemsCount = 0;
-var firstMostVisitedItemId = 0;
-var onNativeSuggestionsCalls = 0;
-var onChangeCalls = 0;
-var submitCount = 0;
-var onEscKeyPressedCalls = 0;
-var onFocusChangedCalls = 0;
-var onToggleVoiceSearchCalls = 0;
-var prefetchQuery = '';
-var isFocused = false;
-var onvisibilitycalls = 0;
-var onThemeChangedCalls = 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 getNewTabPageHandle() {
- if (window.navigator && window.navigator.embeddedSearch &&
- window.navigator.embeddedSearch.newTabPage)
- return window.navigator.embeddedSearch.newTabPage;
- if (window.chrome && window.chrome.embeddedSearch &&
- window.chrome.embeddedSearch.newTabPage)
- return window.chrome.embeddedSearch.newTabPage;
- return null;
-}
-
-function handleNativeSuggestions() {
- onNativeSuggestionsCalls++;
- // Showing the loader at 100% height.
- apiHandle.hideBars();
- apiHandle.showOverlay();
-}
-
-function handleSubmit() {
- location.hash = 'q=' + encodeURIComponent(apiHandle.value);
- submitCount++;
-}
-
-function handleOnChange() {
- onChangeCalls++;
- savedUserText = apiHandle.value;
- suggestionIndex = -1;
- apiHandle.setAutocompleteText(suggestion, behavior);
-}
-
-function nextSuggestion() {
- if (suggestionIndex < suggestions.length - 1) {
- suggestionIndex++;
- apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
- }
-}
-
-function previousSuggestion() {
- if (suggestionIndex != -1) {
- suggestionIndex--;
- if (suggestionIndex == -1) {
- apiHandle.setValue(savedUserText, suggestionType);
- } else {
- apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
- }
- }
-}
-
-function handleKeyPress(event) {
- var VKEY_ESCAPE = 0x1B;
- var VKEY_UP = 0x26;
- var VKEY_DOWN = 0x28;
-
- if (event.keyCode == VKEY_ESCAPE) {
- onEscKeyPressedCalls++;
- if (suggestionIndex != -1) {
- suggestionIndex = -1;
- apiHandle.setAutocompleteText(suggestion, behavior);
- }
- } else if (event.keyCode == VKEY_DOWN) {
- nextSuggestion();
- } else if (event.keyCode == VKEY_UP) {
- previousSuggestion();
- }
-}
-
-function handleMostVisitedChange() {
- onMostVisitedChangedCalls++;
- var items = newTabPageHandle.mostVisited;
- if (items) {
- mostVisitedItemsCount = items.length;
- firstMostVisitedItemId = items[0] ? items[0].rid : 0;
- }
-}
-
-document.addEventListener("visibilitychange", function() {
- onvisibilitycalls++;
-}, false);
-
-function handleFocusChange() {
- onFocusChangedCalls++;
- isFocused = apiHandle.isFocused;
-}
-
-function handleToggleVoiceSearch() {
- onToggleVoiceSearchCalls++;
-}
-
-function handleSuggestionChange() {
- prefetchQuery = getApiHandle().suggestion.text;
-}
-
-function handleThemeChange() {
- onThemeChangedCalls++;
-}
-
-function setUp() {
- apiHandle = getApiHandle();
- if (!apiHandle)
- return;
-
- newTabPageHandle = getNewTabPageHandle();
- apiHandle.onnativesuggestions = handleNativeSuggestions;
- apiHandle.onsubmit = handleSubmit;
- apiHandle.onchange = handleOnChange;
- apiHandle.onkeypress = handleKeyPress;
- apiHandle.onfocuschange = handleFocusChange;
- apiHandle.ontogglevoicesearch = handleToggleVoiceSearch;
- apiHandle.onsuggestionchange = handleSuggestionChange;
- newTabPageHandle.onmostvisitedchange = handleMostVisitedChange;
- newTabPageHandle.onthemechange = handleThemeChange;
- if (apiHandle.value) {
- handleNativeSuggestions();
- handleOnChange();
- }
- if (newTabPageHandle.mostVisited && newTabPageHandle.mostVisited.length) {
- handleMostVisitedChange();
- }
- handleFocusChange();
-}
-
-setUp();
-
- </script>
-
- <meta name="referrer" content="origin" />
-
- </head>
- <body>
- <h1>Instant</h1>
- </body>
-</html>
« no previous file with comments | « trunk/src/chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698