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

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

Issue 17413017: InstantExtended: Don't create overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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::FocusOmniboxAndWaitForInstantOverlaySupport() { 121 void InstantTestBase::FocusOmniboxAndWaitForInstantNTPSupport() {
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() {
131 content::WindowedNotificationObserver ntp_observer( 122 content::WindowedNotificationObserver ntp_observer(
132 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED, 123 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED,
133 content::NotificationService::AllSources()); 124 content::NotificationService::AllSources());
134 content::WindowedNotificationObserver overlay_observer(
135 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
136 content::NotificationService::AllSources());
137 FocusOmnibox(); 125 FocusOmnibox();
138 if (!instant()->ntp() || !instant()->ntp()->supports_instant()) 126 if (!instant()->ntp() || !instant()->ntp()->supports_instant())
139 ntp_observer.Wait(); 127 ntp_observer.Wait();
140 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
141 overlay_observer.Wait();
142 } 128 }
143 129
144 void InstantTestBase::SetOmniboxText(const std::string& text) { 130 void InstantTestBase::SetOmniboxText(const std::string& text) {
145 FocusOmnibox(); 131 FocusOmnibox();
146 omnibox()->SetUserText(UTF8ToUTF16(text)); 132 omnibox()->SetUserText(UTF8ToUTF16(text));
147 } 133 }
148 134
149 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( 135 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
150 const std::string& text) { 136 const std::string& text) {
151 // The order of events may be: 137 // The order of events may be:
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 size_t start = 0, end = 0; 227 size_t start = 0, end = 0;
242 omnibox()->GetSelectionBounds(&start, &end); 228 omnibox()->GetSelectionBounds(&start, &end);
243 if (start > end) 229 if (start > end)
244 std::swap(start, end); 230 std::swap(start, end);
245 return omnibox()->GetText().substr(start, end - start); 231 return omnibox()->GetText().substr(start, end - start);
246 } 232 }
247 233
248 string16 InstantTestBase::GetGrayText() { 234 string16 InstantTestBase::GetGrayText() {
249 return omnibox()->GetInstantSuggestion(); 235 return omnibox()->GetInstantSuggestion();
250 } 236 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.h ('k') | chrome/browser/ui/search/local_ntp_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698