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

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

Issue 16124009: Revert 204709 "Move instant support to SearchTabHelper." (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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } else { 115 } else {
116 browser_->window()->GetLocationBar()->FocusLocation(false); 116 browser_->window()->GetLocationBar()->FocusLocation(false);
117 } 117 }
118 } 118 }
119 119
120 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlaySupport() { 120 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlaySupport() {
121 content::WindowedNotificationObserver observer( 121 content::WindowedNotificationObserver observer(
122 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED, 122 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
123 content::NotificationService::AllSources()); 123 content::NotificationService::AllSources());
124 FocusOmnibox(); 124 FocusOmnibox();
125 if (!instant()->overlay() || !instant()->overlay()->supports_instant()) 125 if (!instant()->overlay() ||
126 !instant()->overlay()->instant_support_determined()) {
126 observer.Wait(); 127 observer.Wait();
128 }
127 } 129 }
128 130
129 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() { 131 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() {
130 content::WindowedNotificationObserver ntp_observer( 132 content::WindowedNotificationObserver ntp_observer(
131 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED, 133 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED,
132 content::NotificationService::AllSources()); 134 content::NotificationService::AllSources());
133 content::WindowedNotificationObserver overlay_observer( 135 content::WindowedNotificationObserver overlay_observer(
134 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED, 136 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
135 content::NotificationService::AllSources()); 137 content::NotificationService::AllSources());
136 FocusOmnibox(); 138 FocusOmnibox();
137 if (!instant()->ntp() || !instant()->ntp()->supports_instant()) 139 if (!instant()->ntp() ||
140 !instant()->ntp()->instant_support_determined()) {
138 ntp_observer.Wait(); 141 ntp_observer.Wait();
139 if (!instant()->overlay() || !instant()->overlay()->supports_instant()) 142 }
143 if (!instant()->overlay() ||
144 !instant()->overlay()->instant_support_determined()) {
140 overlay_observer.Wait(); 145 overlay_observer.Wait();
146 }
141 } 147 }
142 148
143 void InstantTestBase::SetOmniboxText(const std::string& text) { 149 void InstantTestBase::SetOmniboxText(const std::string& text) {
144 FocusOmnibox(); 150 FocusOmnibox();
145 omnibox()->SetUserText(UTF8ToUTF16(text)); 151 omnibox()->SetUserText(UTF8ToUTF16(text));
146 } 152 }
147 153
148 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( 154 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
149 const std::string& text) { 155 const std::string& text) {
150 // The order of events may be: 156 // The order of events may be:
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 size_t start = 0, end = 0; 238 size_t start = 0, end = 0;
233 omnibox()->GetSelectionBounds(&start, &end); 239 omnibox()->GetSelectionBounds(&start, &end);
234 if (start > end) 240 if (start > end)
235 std::swap(start, end); 241 std::swap(start, end);
236 return omnibox()->GetText().substr(start, end - start); 242 return omnibox()->GetText().substr(start, end - start);
237 } 243 }
238 244
239 string16 InstantTestBase::GetGrayText() { 245 string16 InstantTestBase::GetGrayText() {
240 return omnibox()->GetInstantSuggestion(); 246 return omnibox()->GetInstantSuggestion();
241 } 247 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/ui/search/instant_tab.cc ('k') | trunk/src/chrome/browser/ui/search/search_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698