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

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

Issue 14911005: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android_dbg test failures 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 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() || 125 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
126 !instant()->overlay()->instant_support_determined()) {
127 observer.Wait(); 126 observer.Wait();
128 }
129 } 127 }
130 128
131 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() { 129 void InstantTestBase::FocusOmniboxAndWaitForInstantOverlayAndNTPSupport() {
132 content::WindowedNotificationObserver ntp_observer( 130 content::WindowedNotificationObserver ntp_observer(
133 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED, 131 chrome::NOTIFICATION_INSTANT_NTP_SUPPORT_DETERMINED,
134 content::NotificationService::AllSources()); 132 content::NotificationService::AllSources());
135 content::WindowedNotificationObserver overlay_observer( 133 content::WindowedNotificationObserver overlay_observer(
136 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED, 134 chrome::NOTIFICATION_INSTANT_OVERLAY_SUPPORT_DETERMINED,
137 content::NotificationService::AllSources()); 135 content::NotificationService::AllSources());
138 FocusOmnibox(); 136 FocusOmnibox();
139 if (!instant()->ntp() || 137 if (!instant()->ntp() || !instant()->ntp()->supports_instant())
140 !instant()->ntp()->instant_support_determined()) {
141 ntp_observer.Wait(); 138 ntp_observer.Wait();
142 } 139 if (!instant()->overlay() || !instant()->overlay()->supports_instant())
143 if (!instant()->overlay() ||
144 !instant()->overlay()->instant_support_determined()) {
145 overlay_observer.Wait(); 140 overlay_observer.Wait();
146 }
147 } 141 }
148 142
149 void InstantTestBase::SetOmniboxText(const std::string& text) { 143 void InstantTestBase::SetOmniboxText(const std::string& text) {
150 FocusOmnibox(); 144 FocusOmnibox();
151 omnibox()->SetUserText(UTF8ToUTF16(text)); 145 omnibox()->SetUserText(UTF8ToUTF16(text));
152 } 146 }
153 147
154 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( 148 bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
155 const std::string& text) { 149 const std::string& text) {
156 // The order of events may be: 150 // The order of events may be:
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 size_t start = 0, end = 0; 232 size_t start = 0, end = 0;
239 omnibox()->GetSelectionBounds(&start, &end); 233 omnibox()->GetSelectionBounds(&start, &end);
240 if (start > end) 234 if (start > end)
241 std::swap(start, end); 235 std::swap(start, end);
242 return omnibox()->GetText().substr(start, end - start); 236 return omnibox()->GetText().substr(start, end - start);
243 } 237 }
244 238
245 string16 InstantTestBase::GetGrayText() { 239 string16 InstantTestBase::GetGrayText() {
246 return omnibox()->GetInstantSuggestion(); 240 return omnibox()->GetInstantSuggestion();
247 } 241 }
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