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

Side by Side Diff: chrome/browser/ui/search/instant_extended_interactive_uitest.cc

Issue 14843002: InstantExtended: don't reset InstantTab if not ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test. Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | chrome/browser/ui/search/instant_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 ASSERT_TRUE(AddSearchToHistory(ASCIIToUTF16("query"), 10000)); 2278 ASSERT_TRUE(AddSearchToHistory(ASCIIToUTF16("query"), 10000));
2279 BlockUntilHistoryProcessesPendingRequests(); 2279 BlockUntilHistoryProcessesPendingRequests();
2280 2280
2281 SetOmniboxText("quer"); 2281 SetOmniboxText("quer");
2282 2282
2283 // Should get 2 suggestions from SearchProvider: 2283 // Should get 2 suggestions from SearchProvider:
2284 // - SWYT for "quer" 2284 // - SWYT for "quer"
2285 // - Search history suggestion for "query" 2285 // - Search history suggestion for "query"
2286 EXPECT_EQ(2, CountSearchProviderSuggestions()); 2286 EXPECT_EQ(2, CountSearchProviderSuggestions());
2287 } 2287 }
2288
2289 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, UsesOverlayIfTabNotReady) {
2290 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
2291 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
2292
2293 // Navigate to the NTP, and wait for it to be recognized.
2294 content::WindowedNotificationObserver instant_tab_observer(
2295 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
2296 content::NotificationService::AllSources());
2297 ui_test_utils::NavigateToURLWithDisposition(browser(),
2298 GURL(chrome::kChromeUINewTabURL),
2299 NEW_FOREGROUND_TAB,
2300 ui_test_utils::BROWSER_TEST_NONE);
2301 instant_tab_observer.Wait();
2302 ASSERT_TRUE(instant()->instant_tab()->supports_instant());
2303
2304 // Turn off Instant support for the tab and type in the omnibox. Should use
2305 // the overlay.
2306 instant()->instant_tab_->supports_instant_ = false;
sreeram 2013/05/05 21:06:41 Why do this? If you removed the observer and obser
samarth 2013/05/05 21:18:34 Ah yes, that's better. Done.
2307 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query"));
2308 // But Instant tab should still exist
2309 EXPECT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab());
2310 EXPECT_FALSE(instant()->UseTabForSuggestions());
2311
2312 // Restore Instant support for the tab and force the overlay to be hidden.
2313 instant()->instant_tab_->supports_instant_ = true;
2314 instant()->HideOverlay();
2315
2316 // Now, we should be using Instant tab for suggestions.
2317 EXPECT_TRUE(instant()->UseTabForSuggestions());
2318 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | chrome/browser/ui/search/instant_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698