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

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

Issue 13963014: Local omnibox treats navsuggest suggestions as queries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/search/search.h" 6 #include "chrome/browser/search/search.h"
7 #include "chrome/browser/task_manager/task_manager.h" 7 #include "chrome/browser/task_manager/task_manager.h"
8 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 8 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); 135 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
136 136
137 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); 137 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
138 EXPECT_FALSE(omnibox()->model()->has_focus()); 138 EXPECT_FALSE(omnibox()->model()->has_focus());
139 139
140 // Delete any existing overlay. 140 // Delete any existing overlay.
141 instant()->overlay_.reset(); 141 instant()->overlay_.reset();
142 EXPECT_FALSE(instant()->GetOverlayContents()); 142 EXPECT_FALSE(instant()->GetOverlayContents());
143 143
144 // Refocus the omnibox. The InstantController should've preloaded Instant. 144 // Refocus the omnibox. The InstantController should've preloaded Instant.
145 FocusOmniboxAndWaitForInstantExtendedSupport(); 145 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
146 EXPECT_TRUE(OverlayIsGoogle()); 146 EXPECT_TRUE(OverlayIsGoogle());
147 147
148 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); 148 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
149 EXPECT_TRUE(omnibox()->model()->has_focus()); 149 EXPECT_TRUE(omnibox()->model()->has_focus());
150 150
151 // Check that the page supports Instant, but it isn't showing. 151 // Check that the page supports Instant, but it isn't showing.
152 ASSERT_TRUE(instant()->overlay()); 152 ASSERT_TRUE(instant()->overlay());
153 EXPECT_TRUE(instant()->overlay()->supports_instant()); 153 EXPECT_TRUE(instant()->overlay()->supports_instant());
154 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); 154 EXPECT_FALSE(instant()->IsOverlayingSearchResults());
155 EXPECT_TRUE(instant()->model()->mode().is_default()); 155 EXPECT_TRUE(instant()->model()->mode().is_default());
156 } 156 }
157 157
158 // TODO: http://crbug.com/230940 158 // TODO: http://crbug.com/230940
159 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 159 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
160 DISABLED_BackspaceFromQueryToSameQueryAndSearch) { 160 DISABLED_BackspaceFromQueryToSameQueryAndSearch) {
161 set_browser(browser()); 161 set_browser(browser());
162 FocusOmniboxAndWaitForInstantExtendedSupport(); 162 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
163 EXPECT_TRUE(OverlayIsGoogle()); 163 EXPECT_TRUE(OverlayIsGoogle());
164 164
165 // Type "face" and expect Google to set gray text for "book" to suggest 165 // Type "face" and expect Google to set gray text for "book" to suggest
166 // [facebook], the query. 166 // [facebook], the query.
167 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("face")); 167 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("face"));
168 EXPECT_EQ(ASCIIToUTF16("face"), omnibox()->GetText()); 168 EXPECT_EQ(ASCIIToUTF16("face"), omnibox()->GetText());
169 EXPECT_EQ(ASCIIToUTF16("book"), GetGrayText()); 169 EXPECT_EQ(ASCIIToUTF16("book"), GetGrayText());
170 170
171 // Backspace to the text "fac". 171 // Backspace to the text "fac".
172 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); 172 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions());
173 EXPECT_EQ(ASCIIToUTF16("fac"), omnibox()->GetText()); 173 EXPECT_EQ(ASCIIToUTF16("fac"), omnibox()->GetText());
174 EXPECT_EQ(ASCIIToUTF16("ebook"), GetGrayText()); 174 EXPECT_EQ(ASCIIToUTF16("ebook"), GetGrayText());
175 175
176 // Press Enter. The page should show search results for [fac]. 176 // Press Enter. The page should show search results for [fac].
177 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( 177 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle(
178 instant()->GetOverlayContents(), 178 instant()->GetOverlayContents(),
179 ASCIIToUTF16("fac - Google Search"))); 179 ASCIIToUTF16("fac - Google Search")));
180 } 180 }
181 181
182 // TODO: http://crbug.com/230940 182 // TODO: http://crbug.com/230940
183 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 183 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
184 DISABLED_BackspaceFromQueryToOtherQueryAndSearch) { 184 DISABLED_BackspaceFromQueryToOtherQueryAndSearch) {
185 set_browser(browser()); 185 set_browser(browser());
186 FocusOmniboxAndWaitForInstantExtendedSupport(); 186 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
187 EXPECT_TRUE(OverlayIsGoogle()); 187 EXPECT_TRUE(OverlayIsGoogle());
188 188
189 // Type "fan" and expect Google to set gray text to "dango" to suggest 189 // Type "fan" and expect Google to set gray text to "dango" to suggest
190 // [fandango], the query. 190 // [fandango], the query.
191 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("fan")); 191 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("fan"));
192 EXPECT_EQ(ASCIIToUTF16("fan"), omnibox()->GetText()); 192 EXPECT_EQ(ASCIIToUTF16("fan"), omnibox()->GetText());
193 EXPECT_EQ(ASCIIToUTF16("dango"), GetGrayText()); 193 EXPECT_EQ(ASCIIToUTF16("dango"), GetGrayText());
194 194
195 // Backspace to the text "fa". Expect Google to set gray text for "cebook" to 195 // Backspace to the text "fa". Expect Google to set gray text for "cebook" to
196 // suggest [facebook], the query. 196 // suggest [facebook], the query.
197 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); 197 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions());
198 EXPECT_EQ(ASCIIToUTF16("fa"), omnibox()->GetText()); 198 EXPECT_EQ(ASCIIToUTF16("fa"), omnibox()->GetText());
199 EXPECT_EQ(ASCIIToUTF16("cebook"), GetGrayText()); 199 EXPECT_EQ(ASCIIToUTF16("cebook"), GetGrayText());
200 200
201 // Press Enter. Instant should clear gray text and submit the query [fa]. 201 // Press Enter. Instant should clear gray text and submit the query [fa].
202 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( 202 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle(
203 instant()->GetOverlayContents(), 203 instant()->GetOverlayContents(),
204 ASCIIToUTF16("fa - Google Search"))); 204 ASCIIToUTF16("fa - Google Search")));
205 } 205 }
206 206
207 // TODO: http://crbug.com/230537 207 // TODO: http://crbug.com/230537
208 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 208 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
209 DISABLED_BackspaceFromUrlToNonSelectedUrlAndSearch) { 209 DISABLED_BackspaceFromUrlToNonSelectedUrlAndSearch) {
210 set_browser(browser()); 210 set_browser(browser());
211 FocusOmniboxAndWaitForInstantExtendedSupport(); 211 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
212 EXPECT_TRUE(OverlayIsGoogle()); 212 EXPECT_TRUE(OverlayIsGoogle());
213 213
214 // Type "facebook.c" and expect Google to set blue text to "om" to suggest 214 // Type "facebook.c" and expect Google to set blue text to "om" to suggest
215 // http://www.facebook.com/, the URL. 215 // http://www.facebook.com/, the URL.
216 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.c")); 216 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.c"));
217 EXPECT_EQ(ASCIIToUTF16("facebook.com"), omnibox()->GetText()); 217 EXPECT_EQ(ASCIIToUTF16("facebook.com"), omnibox()->GetText());
218 EXPECT_EQ(ASCIIToUTF16("om"), GetBlueText()); 218 EXPECT_EQ(ASCIIToUTF16("om"), GetBlueText());
219 bool selected = false; 219 bool selected = false;
220 EXPECT_TRUE(GetSelectionState(&selected)); 220 EXPECT_TRUE(GetSelectionState(&selected));
221 EXPECT_TRUE(selected); 221 EXPECT_TRUE(selected);
222 222
223 // Backspace to the text "facebook.c". Expect no suggestion text and no 223 // Backspace to the text "facebook.c". Expect no suggestion text and no
224 // selected suggestion. 224 // selected suggestion.
225 // Page won't actually show because it's showing "press enter to search". 225 // Page won't actually show because it's showing "press enter to search".
226 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); 226 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions());
227 EXPECT_EQ(ASCIIToUTF16("facebook.c"), omnibox()->GetText()); 227 EXPECT_EQ(ASCIIToUTF16("facebook.c"), omnibox()->GetText());
228 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); 228 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText());
229 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); 229 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
230 EXPECT_TRUE(GetSelectionState(&selected)); 230 EXPECT_TRUE(GetSelectionState(&selected));
231 EXPECT_FALSE(selected); 231 EXPECT_FALSE(selected);
232 232
233 // Press Enter. Instant should submit the query "facebook.c". 233 // Press Enter. Instant should submit the query "facebook.c".
234 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( 234 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle(
235 active_tab(), ASCIIToUTF16("facebook.c - Google Search"))); 235 active_tab(), ASCIIToUTF16("facebook.c - Google Search")));
236 } 236 }
237 237
238 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 238 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
239 MANUAL_BackspaceFromUrlToUrlAndNavigate) { 239 MANUAL_BackspaceFromUrlToUrlAndNavigate) {
240 set_browser(browser()); 240 set_browser(browser());
241 FocusOmniboxAndWaitForInstantExtendedSupport(); 241 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
242 EXPECT_TRUE(OverlayIsGoogle()); 242 EXPECT_TRUE(OverlayIsGoogle());
243 243
244 // Type "facebook.com/" and expect Google to set blue text to "login.php" to 244 // Type "facebook.com/" and expect Google to set blue text to "login.php" to
245 // suggest http://www.facebook.com/login.php, the URL. 245 // suggest http://www.facebook.com/login.php, the URL.
246 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.com/")); 246 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.com/"));
247 EXPECT_EQ(ASCIIToUTF16("facebook.com/login.php"), omnibox()->GetText()); 247 EXPECT_EQ(ASCIIToUTF16("facebook.com/login.php"), omnibox()->GetText());
248 EXPECT_EQ(ASCIIToUTF16("login.php"), GetBlueText()); 248 EXPECT_EQ(ASCIIToUTF16("login.php"), GetBlueText());
249 bool selected = false; 249 bool selected = false;
250 EXPECT_TRUE(GetSelectionState(&selected)); 250 EXPECT_TRUE(GetSelectionState(&selected));
251 EXPECT_TRUE(selected); 251 EXPECT_TRUE(selected);
(...skipping 10 matching lines...) Expand all
262 262
263 // Press Enter. Instant should navigate to facebook.com. 263 // Press Enter. Instant should navigate to facebook.com.
264 PressEnterAndWaitForNavigation(); 264 PressEnterAndWaitForNavigation();
265 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); 265 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com"));
266 } 266 }
267 267
268 // TODO: http://crbug.com/230537 268 // TODO: http://crbug.com/230537
269 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 269 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
270 DISABLED_BackspaceFromQueryToSelectedUrlAndNavigate) { 270 DISABLED_BackspaceFromQueryToSelectedUrlAndNavigate) {
271 set_browser(browser()); 271 set_browser(browser());
272 FocusOmniboxAndWaitForInstantExtendedSupport(); 272 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
273 EXPECT_TRUE(OverlayIsGoogle()); 273 EXPECT_TRUE(OverlayIsGoogle());
274 274
275 // Type "a.cop" and expect Google to set gray text to "land" to suggest the 275 // Type "a.cop" and expect Google to set gray text to "land" to suggest the
276 // query [a.copland]. 276 // query [a.copland].
277 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a.cop")); 277 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a.cop"));
278 EXPECT_EQ(ASCIIToUTF16("a.cop"), omnibox()->GetText()); 278 EXPECT_EQ(ASCIIToUTF16("a.cop"), omnibox()->GetText());
279 EXPECT_EQ(ASCIIToUTF16("land"), GetGrayText()); 279 EXPECT_EQ(ASCIIToUTF16("land"), GetGrayText());
280 280
281 // Backspace to the text "a.co". Expect no suggestion text, but the 281 // Backspace to the text "a.co". Expect no suggestion text, but the
282 // first suggestion should be selected URL "a.co". 282 // first suggestion should be selected URL "a.co".
283 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); 283 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions());
284 EXPECT_EQ(ASCIIToUTF16("a.co"), omnibox()->GetText()); 284 EXPECT_EQ(ASCIIToUTF16("a.co"), omnibox()->GetText());
285 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); 285 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText());
286 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); 286 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
287 bool selected = false; 287 bool selected = false;
288 EXPECT_TRUE(GetSelectionState(&selected)); 288 EXPECT_TRUE(GetSelectionState(&selected));
289 EXPECT_TRUE(selected); 289 EXPECT_TRUE(selected);
290 290
291 // Press Enter. Instant should navigate to a.co/. 291 // Press Enter. Instant should navigate to a.co/.
292 PressEnterAndWaitForNavigation(); 292 PressEnterAndWaitForNavigation();
293 EXPECT_TRUE(GetActiveTabURL().DomainIs("amazon.com")); 293 EXPECT_TRUE(GetActiveTabURL().DomainIs("amazon.com"));
294 } 294 }
295 295
296 // TODO: http://crbug.com/230491 296 // TODO: http://crbug.com/230491
297 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 297 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
298 DISABLED_BackspaceFromSelectedUrlToQueryAndSearch) { 298 DISABLED_BackspaceFromSelectedUrlToQueryAndSearch) {
299 set_browser(browser()); 299 set_browser(browser());
300 FocusOmniboxAndWaitForInstantExtendedSupport(); 300 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
301 EXPECT_TRUE(OverlayIsGoogle()); 301 EXPECT_TRUE(OverlayIsGoogle());
302 302
303 // Type "e.co/" and expect the top suggestion to be the URL "e.co/". 303 // Type "e.co/" and expect the top suggestion to be the URL "e.co/".
304 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("e.co/")); 304 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("e.co/"));
305 EXPECT_EQ(ASCIIToUTF16("e.co/"), omnibox()->GetText()); 305 EXPECT_EQ(ASCIIToUTF16("e.co/"), omnibox()->GetText());
306 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); 306 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText());
307 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); 307 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
308 bool selected = false; 308 bool selected = false;
309 EXPECT_TRUE(GetSelectionState(&selected)); 309 EXPECT_TRUE(GetSelectionState(&selected));
310 EXPECT_TRUE(selected); 310 EXPECT_TRUE(selected);
311 311
312 // Backspace to the text "e.co". Expect Google to suggest the query [e.coli]. 312 // Backspace to the text "e.co". Expect Google to suggest the query [e.coli].
313 EXPECT_TRUE(PressBackspaceAndWaitForOverlayToShow()); 313 EXPECT_TRUE(PressBackspaceAndWaitForOverlayToShow());
314 EXPECT_EQ(ASCIIToUTF16("e.co"), omnibox()->GetText()); 314 EXPECT_EQ(ASCIIToUTF16("e.co"), omnibox()->GetText());
315 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); 315 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText());
316 EXPECT_EQ(ASCIIToUTF16("li"), GetGrayText()); 316 EXPECT_EQ(ASCIIToUTF16("li"), GetGrayText());
317 selected = true; 317 selected = true;
318 EXPECT_TRUE(GetSelectionState(&selected)); 318 EXPECT_TRUE(GetSelectionState(&selected));
319 EXPECT_FALSE(selected); 319 EXPECT_FALSE(selected);
320 320
321 // Press Enter. Instant should search for "e.co". 321 // Press Enter. Instant should search for "e.co".
322 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( 322 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle(
323 instant()->GetOverlayContents(), 323 instant()->GetOverlayContents(),
324 ASCIIToUTF16("e.co - Google Search"))); 324 ASCIIToUTF16("e.co - Google Search")));
325 } 325 }
326 326
327 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_TypeURLAndPressEnter) { 327 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_TypeURLAndPressEnter) {
328 set_browser(browser()); 328 set_browser(browser());
329 FocusOmniboxAndWaitForInstantExtendedSupport(); 329 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
330 EXPECT_TRUE(OverlayIsGoogle()); 330 EXPECT_TRUE(OverlayIsGoogle());
331 331
332 // Type "www.facebook.com" and expect the top suggestion to be the URL 332 // Type "www.facebook.com" and expect the top suggestion to be the URL
333 // facebook.com. 333 // facebook.com.
334 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("www.facebook.com")); 334 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("www.facebook.com"));
335 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); 335 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText());
336 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); 336 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText());
337 bool selected = false; 337 bool selected = false;
338 EXPECT_TRUE(GetSelectionState(&selected)); 338 EXPECT_TRUE(GetSelectionState(&selected));
339 EXPECT_TRUE(selected); 339 EXPECT_TRUE(selected);
340 340
341 // Press Enter. Should navigate to facebook.com. 341 // Press Enter. Should navigate to facebook.com.
342 PressEnterAndWaitForNavigation(); 342 PressEnterAndWaitForNavigation();
343 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); 343 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com"));
344 } 344 }
345 345
346 // TODO: http://crbug.com/232088 346 // TODO: http://crbug.com/232088
347 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 347 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
348 DISABLED_TypeAutocompletedURLAndPressEnter) { 348 DISABLED_TypeAutocompletedURLAndPressEnter) {
349 set_browser(browser()); 349 set_browser(browser());
350 FocusOmniboxAndWaitForInstantExtendedSupport(); 350 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
351 EXPECT_TRUE(OverlayIsGoogle()); 351 EXPECT_TRUE(OverlayIsGoogle());
352 352
353 // Type "www.facebook." and expect the top suggestion to be the URL 353 // Type "www.facebook." and expect the top suggestion to be the URL
354 // www.facebook.com. 354 // www.facebook.com.
355 SetOmniboxTextAndWaitForSuggestion("www.facebook."); 355 SetOmniboxTextAndWaitForSuggestion("www.facebook.");
356 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); 356 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText());
357 EXPECT_EQ(ASCIIToUTF16("com"), GetBlueText()); 357 EXPECT_EQ(ASCIIToUTF16("com"), GetBlueText());
358 bool selected = false; 358 bool selected = false;
359 EXPECT_TRUE(GetSelectionState(&selected)); 359 EXPECT_TRUE(GetSelectionState(&selected));
360 EXPECT_TRUE(selected); 360 EXPECT_TRUE(selected);
361 361
362 // Press Enter. Should navigate to facebook.com. 362 // Press Enter. Should navigate to facebook.com.
363 PressEnterAndWaitForNavigation(); 363 PressEnterAndWaitForNavigation();
364 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); 364 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com"));
365 } 365 }
366 366
367 // TODO: http://crbug.com/230537 367 // TODO: http://crbug.com/230537
368 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 368 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
369 DISABLED_PasteURLAndPressEnter) { 369 DISABLED_PasteURLAndPressEnter) {
370 set_browser(browser()); 370 set_browser(browser());
371 FocusOmniboxAndWaitForInstantExtendedSupport(); 371 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
372 EXPECT_TRUE(OverlayIsGoogle()); 372 EXPECT_TRUE(OverlayIsGoogle());
373 373
374 // Paste "www.facebook.com" and expect the top suggestion to be the URL 374 // Paste "www.facebook.com" and expect the top suggestion to be the URL
375 // facebook.com. 375 // facebook.com.
376 InstantTestModelObserver observer( 376 InstantTestModelObserver observer(
377 instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS); 377 instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS);
378 omnibox()->OnBeforePossibleChange(); 378 omnibox()->OnBeforePossibleChange();
379 omnibox()->model()->on_paste(); 379 omnibox()->model()->on_paste();
380 SetOmniboxText("www.facebook.com"); 380 SetOmniboxText("www.facebook.com");
381 omnibox()->OnAfterPossibleChange(); 381 omnibox()->OnAfterPossibleChange();
382 ASSERT_TRUE(observer.WaitForExpectedOverlayState()); 382 ASSERT_TRUE(observer.WaitForExpectedOverlayState());
383 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); 383 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText());
384 EXPECT_EQ(string16(), GetBlueText()); 384 EXPECT_EQ(string16(), GetBlueText());
385 bool selected = false; 385 bool selected = false;
386 EXPECT_TRUE(GetSelectionState(&selected)); 386 EXPECT_TRUE(GetSelectionState(&selected));
387 EXPECT_TRUE(selected); 387 EXPECT_TRUE(selected);
388 388
389 // Press Enter. Should navigate to facebook.com. 389 // Press Enter. Should navigate to facebook.com.
390 PressEnterAndWaitForNavigation(); 390 PressEnterAndWaitForNavigation();
391 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); 391 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com"));
392 } 392 }
393 393
394 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_PasteAndGo) { 394 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_PasteAndGo) {
395 set_browser(browser()); 395 set_browser(browser());
396 FocusOmniboxAndWaitForInstantExtendedSupport(); 396 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
397 EXPECT_TRUE(OverlayIsGoogle()); 397 EXPECT_TRUE(OverlayIsGoogle());
398 398
399 // "Paste and Go" with the text www.facebook.com. 399 // "Paste and Go" with the text www.facebook.com.
400 content::WindowedNotificationObserver nav_observer( 400 content::WindowedNotificationObserver nav_observer(
401 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 401 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
402 content::NotificationService::AllSources()); 402 content::NotificationService::AllSources());
403 omnibox()->model()->PasteAndGo(ASCIIToUTF16("www.facebook.com")); 403 omnibox()->model()->PasteAndGo(ASCIIToUTF16("www.facebook.com"));
404 nav_observer.Wait(); 404 nav_observer.Wait();
405 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); 405 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com"));
406 } 406 }
407 407
408 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 408 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
409 MANUAL_TypeSearchAndPressControlEnter) { 409 MANUAL_TypeSearchAndPressControlEnter) {
410 set_browser(browser()); 410 set_browser(browser());
411 FocusOmniboxAndWaitForInstantExtendedSupport(); 411 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
412 EXPECT_TRUE(OverlayIsGoogle()); 412 EXPECT_TRUE(OverlayIsGoogle());
413 413
414 // Type "example" and expect Google to suggest a query, i.e., no blue text. 414 // Type "example" and expect Google to suggest a query, i.e., no blue text.
415 SetOmniboxTextAndWaitForSuggestion("example"); 415 SetOmniboxTextAndWaitForSuggestion("example");
416 EXPECT_EQ(ASCIIToUTF16("example"), omnibox()->GetText()); 416 EXPECT_EQ(ASCIIToUTF16("example"), omnibox()->GetText());
417 EXPECT_EQ(string16(), GetBlueText()); 417 EXPECT_EQ(string16(), GetBlueText());
418 418
419 // Press ctrl+enter and expect to navigate to example.com. 419 // Press ctrl+enter and expect to navigate to example.com.
420 content::WindowedNotificationObserver nav_observer( 420 content::WindowedNotificationObserver nav_observer(
421 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 421 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
422 content::NotificationService::AllSources()); 422 content::NotificationService::AllSources());
423 omnibox()->model()->OnControlKeyChanged(true); 423 omnibox()->model()->OnControlKeyChanged(true);
424 browser()->window()->GetLocationBar()->AcceptInput(); 424 browser()->window()->GetLocationBar()->AcceptInput();
425 nav_observer.Wait(); 425 nav_observer.Wait();
426 // example.com redirects to iana. 426 // example.com redirects to iana.
427 EXPECT_TRUE(GetActiveTabURL().DomainIs("example.com") || 427 EXPECT_TRUE(GetActiveTabURL().DomainIs("example.com") ||
428 GetActiveTabURL().DomainIs("iana.org")); 428 GetActiveTabURL().DomainIs("iana.org"));
429 } 429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698