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

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

Issue 16035020: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nits 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
« no previous file with comments | « chrome/browser/ui/search/instant_tab.cc ('k') | chrome/browser/ui/search/search_model.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 "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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::FocusOmniboxAndWaitForInstantOverlaySupport() {
122 content::WindowedNotificationObserver observer( 122 content::WindowedNotificationObserver observer(
123 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED, 123 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
124 content::NotificationService::AllSources()); 124 content::NotificationService::AllSources());
125 FocusOmnibox(); 125 FocusOmnibox();
126 if (!instant()->overlay() || 126 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
127 !instant()->overlay()->instant_support_determined()) {
128 observer.Wait(); 127 observer.Wait();
129 }
130 } 128 }
131 129
132 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() { 130 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() {
133 content::WindowedNotificationObserver ntp_observer( 131 content::WindowedNotificationObserver ntp_observer(
134 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED, 132 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED,
135 content::NotificationService::AllSources()); 133 content::NotificationService::AllSources());
136 content::WindowedNotificationObserver overlay_observer( 134 content::WindowedNotificationObserver overlay_observer(
137 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED, 135 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
138 content::NotificationService::AllSources()); 136 content::NotificationService::AllSources());
139 FocusOmnibox(); 137 FocusOmnibox();
140 if (!instant()->ntp() || 138 if (!instant()->ntp() || !instant()->ntp()->supports_instant())
141 !instant()->ntp()->instant_support_determined()) {
142 ntp_observer.Wait(); 139 ntp_observer.Wait();
143 } 140 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
144 if (!instant()->overlay() ||
145 !instant()->overlay()->instant_support_determined()) {
146 overlay_observer.Wait(); 141 overlay_observer.Wait();
147 }
148 } 142 }
149 143
150 void InstantTestBase::SetOmniboxText(const std::string& text) { 144 void InstantTestBase::SetOmniboxText(const std::string& text) {
151 FocusOmnibox(); 145 FocusOmnibox();
152 omnibox()->SetUserText(UTF8ToUTF16(text)); 146 omnibox()->SetUserText(UTF8ToUTF16(text));
153 } 147 }
154 148
155 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( 149 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
156 const std::string& text) { 150 const std::string& text) {
157 // 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
247 size_t start = 0, end = 0; 241 size_t start = 0, end = 0;
248 omnibox()->GetSelectionBounds(&start, &end); 242 omnibox()->GetSelectionBounds(&start, &end);
249 if (start > end) 243 if (start > end)
250 std::swap(start, end); 244 std::swap(start, end);
251 return omnibox()->GetText().substr(start, end - start); 245 return omnibox()->GetText().substr(start, end - start);
252 } 246 }
253 247
254 string16 InstantTestBase::GetGrayText() { 248 string16 InstantTestBase::GetGrayText() {
255 return omnibox()->GetInstantSuggestion(); 249 return omnibox()->GetInstantSuggestion();
256 } 250 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_tab.cc ('k') | chrome/browser/ui/search/search_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698