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

Side by Side Diff: trunk/src/chrome/browser/ui/search/instant_test_utils.cc

Issue 17444007: Revert 207790 "InstantExtended: Don't create overlay, again." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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
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 "chrome/browser/ui/search/instant_test_utils.h" 5 #include "chrome/browser/ui/search/instant_test_utils.h"
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 "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void InstantTestBase::FocusOmnibox() { 111 void InstantTestBase::FocusOmnibox() {
112 // If the omnibox already has focus, just notify Instant. 112 // If the omnibox already has focus, just notify Instant.
113 if (omnibox()->model()->has_focus()) { 113 if (omnibox()->model()->has_focus()) {
114 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE, 114 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE,
115 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); 115 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL);
116 } else { 116 } else {
117 browser_->window()->GetLocationBar()->FocusLocation(false); 117 browser_->window()->GetLocationBar()->FocusLocation(false);
118 } 118 }
119 } 119 }
120 120
121 void InstantTestBase::FocusOmniboxAndWaitForInstantNTPSupport() { 121 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlaySupport() {
122 content::WindowedNotificationObserver observer(
123 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
124 content::NotificationService::AllSources());
125 FocusOmnibox();
126 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
127 observer.Wait();
128 }
129
130 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() {
122 content::WindowedNotificationObserver ntp_observer( 131 content::WindowedNotificationObserver ntp_observer(
123 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED, 132 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED,
124 content::NotificationService::AllSources()); 133 content::NotificationService::AllSources());
134 content::WindowedNotificationObserver overlay_observer(
135 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
136 content::NotificationService::AllSources());
125 FocusOmnibox(); 137 FocusOmnibox();
126 if (!instant()->ntp() || !instant()->ntp()->supports_instant()) 138 if (!instant()->ntp() || !instant()->ntp()->supports_instant())
127 ntp_observer.Wait(); 139 ntp_observer.Wait();
140 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
141 overlay_observer.Wait();
128 } 142 }
129 143
130 void InstantTestBase::SetOmniboxText(const std::string& text) { 144 void InstantTestBase::SetOmniboxText(const std::string& text) {
131 FocusOmnibox(); 145 FocusOmnibox();
132 omnibox()->SetUserText(UTF8ToUTF16(text)); 146 omnibox()->SetUserText(UTF8ToUTF16(text));
133 } 147 }
134 148
135 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( 149 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
136 const std::string& text) { 150 const std::string& text) {
137 // The order of events may be: 151 // The order of events may be:
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 size_t start = 0, end = 0; 241 size_t start = 0, end = 0;
228 omnibox()->GetSelectionBounds(&start, &end); 242 omnibox()->GetSelectionBounds(&start, &end);
229 if (start > end) 243 if (start > end)
230 std::swap(start, end); 244 std::swap(start, end);
231 return omnibox()->GetText().substr(start, end - start); 245 return omnibox()->GetText().substr(start, end - start);
232 } 246 }
233 247
234 string16 InstantTestBase::GetGrayText() { 248 string16 InstantTestBase::GetGrayText() {
235 return omnibox()->GetInstantSuggestion(); 249 return omnibox()->GetInstantSuggestion();
236 } 250 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/ui/search/instant_test_utils.h ('k') | trunk/src/chrome/browser/ui/search/local_ntp_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698