OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 chrome::NOTIFICATION_INSTANT_SET_SUGGESTION, | 77 chrome::NOTIFICATION_INSTANT_SET_SUGGESTION, |
78 content::NotificationService::AllSources()); | 78 content::NotificationService::AllSources()); |
79 bool result = PressBackspace(); | 79 bool result = PressBackspace(); |
80 observer.Wait(); | 80 observer.Wait(); |
81 return result; | 81 return result; |
82 } | 82 } |
83 | 83 |
84 bool PressBackspaceAndWaitForOverlayToShow() { | 84 bool PressBackspaceAndWaitForOverlayToShow() { |
85 InstantTestModelObserver observer( | 85 InstantTestModelObserver observer( |
86 instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS); | 86 instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS); |
87 bool result = PressBackspace(); | 87 return PressBackspace() && observer.WaitForExpectedOverlayState(); |
88 observer.WaitForDesiredOverlayState(); | |
89 return result; | |
90 } | 88 } |
91 | 89 |
92 void PressEnterAndWaitForNavigation() { | 90 void PressEnterAndWaitForNavigation() { |
93 content::WindowedNotificationObserver nav_observer( | 91 content::WindowedNotificationObserver nav_observer( |
94 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 92 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
95 content::NotificationService::AllSources()); | 93 content::NotificationService::AllSources()); |
96 browser()->window()->GetLocationBar()->AcceptInput(); | 94 browser()->window()->GetLocationBar()->AcceptInput(); |
97 nav_observer.Wait(); | 95 nav_observer.Wait(); |
98 } | 96 } |
99 | 97 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 157 |
160 // TODO: http://crbug.com/230940 | 158 // TODO: http://crbug.com/230940 |
161 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 159 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
162 DISABLED_BackspaceFromQueryToSameQueryAndSearch) { | 160 DISABLED_BackspaceFromQueryToSameQueryAndSearch) { |
163 set_browser(browser()); | 161 set_browser(browser()); |
164 FocusOmniboxAndWaitForInstantExtendedSupport(); | 162 FocusOmniboxAndWaitForInstantExtendedSupport(); |
165 EXPECT_TRUE(OverlayIsGoogle()); | 163 EXPECT_TRUE(OverlayIsGoogle()); |
166 | 164 |
167 // 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 |
168 // [facebook], the query. | 166 // [facebook], the query. |
169 SetOmniboxTextAndWaitForOverlayToShow("face"); | 167 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("face")); |
170 EXPECT_EQ(ASCIIToUTF16("face"), omnibox()->GetText()); | 168 EXPECT_EQ(ASCIIToUTF16("face"), omnibox()->GetText()); |
171 EXPECT_EQ(ASCIIToUTF16("book"), GetGrayText()); | 169 EXPECT_EQ(ASCIIToUTF16("book"), GetGrayText()); |
172 | 170 |
173 // Backspace to the text "fac". | 171 // Backspace to the text "fac". |
174 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); | 172 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); |
175 EXPECT_EQ(ASCIIToUTF16("fac"), omnibox()->GetText()); | 173 EXPECT_EQ(ASCIIToUTF16("fac"), omnibox()->GetText()); |
176 EXPECT_EQ(ASCIIToUTF16("ebook"), GetGrayText()); | 174 EXPECT_EQ(ASCIIToUTF16("ebook"), GetGrayText()); |
177 | 175 |
178 // Press Enter. The page should show search results for [fac]. | 176 // Press Enter. The page should show search results for [fac]. |
179 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( | 177 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( |
180 instant()->GetOverlayContents(), | 178 instant()->GetOverlayContents(), |
181 ASCIIToUTF16("fac - Google Search"))); | 179 ASCIIToUTF16("fac - Google Search"))); |
182 } | 180 } |
183 | 181 |
184 // TODO: http://crbug.com/230940 | 182 // TODO: http://crbug.com/230940 |
185 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 183 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
186 DISABLED_BackspaceFromQueryToOtherQueryAndSearch) { | 184 DISABLED_BackspaceFromQueryToOtherQueryAndSearch) { |
187 set_browser(browser()); | 185 set_browser(browser()); |
188 FocusOmniboxAndWaitForInstantExtendedSupport(); | 186 FocusOmniboxAndWaitForInstantExtendedSupport(); |
189 EXPECT_TRUE(OverlayIsGoogle()); | 187 EXPECT_TRUE(OverlayIsGoogle()); |
190 | 188 |
191 // 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 |
192 // [fandango], the query. | 190 // [fandango], the query. |
193 SetOmniboxTextAndWaitForOverlayToShow("fan"); | 191 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("fan")); |
194 EXPECT_EQ(ASCIIToUTF16("fan"), omnibox()->GetText()); | 192 EXPECT_EQ(ASCIIToUTF16("fan"), omnibox()->GetText()); |
195 EXPECT_EQ(ASCIIToUTF16("dango"), GetGrayText()); | 193 EXPECT_EQ(ASCIIToUTF16("dango"), GetGrayText()); |
196 | 194 |
197 // 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 |
198 // suggest [facebook], the query. | 196 // suggest [facebook], the query. |
199 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); | 197 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); |
200 EXPECT_EQ(ASCIIToUTF16("fa"), omnibox()->GetText()); | 198 EXPECT_EQ(ASCIIToUTF16("fa"), omnibox()->GetText()); |
201 EXPECT_EQ(ASCIIToUTF16("cebook"), GetGrayText()); | 199 EXPECT_EQ(ASCIIToUTF16("cebook"), GetGrayText()); |
202 | 200 |
203 // 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]. |
204 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( | 202 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( |
205 instant()->GetOverlayContents(), | 203 instant()->GetOverlayContents(), |
206 ASCIIToUTF16("fa - Google Search"))); | 204 ASCIIToUTF16("fa - Google Search"))); |
207 } | 205 } |
208 | 206 |
209 // TODO: http://crbug.com/230537 | 207 // TODO: http://crbug.com/230537 |
210 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 208 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
211 DISABLED_BackspaceFromUrlToNonSelectedUrlAndSearch) { | 209 DISABLED_BackspaceFromUrlToNonSelectedUrlAndSearch) { |
212 set_browser(browser()); | 210 set_browser(browser()); |
213 FocusOmniboxAndWaitForInstantExtendedSupport(); | 211 FocusOmniboxAndWaitForInstantExtendedSupport(); |
214 EXPECT_TRUE(OverlayIsGoogle()); | 212 EXPECT_TRUE(OverlayIsGoogle()); |
215 | 213 |
216 // 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 |
217 // http://www.facebook.com/, the URL. | 215 // http://www.facebook.com/, the URL. |
218 SetOmniboxTextAndWaitForOverlayToShow("facebook.c"); | 216 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.c")); |
219 EXPECT_EQ(ASCIIToUTF16("facebook.com"), omnibox()->GetText()); | 217 EXPECT_EQ(ASCIIToUTF16("facebook.com"), omnibox()->GetText()); |
220 EXPECT_EQ(ASCIIToUTF16("om"), GetBlueText()); | 218 EXPECT_EQ(ASCIIToUTF16("om"), GetBlueText()); |
221 bool selected = false; | 219 bool selected = false; |
222 EXPECT_TRUE(GetSelectionState(&selected)); | 220 EXPECT_TRUE(GetSelectionState(&selected)); |
223 EXPECT_TRUE(selected); | 221 EXPECT_TRUE(selected); |
224 | 222 |
225 // 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 |
226 // selected suggestion. | 224 // selected suggestion. |
227 // 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". |
228 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); | 226 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); |
229 EXPECT_EQ(ASCIIToUTF16("facebook.c"), omnibox()->GetText()); | 227 EXPECT_EQ(ASCIIToUTF16("facebook.c"), omnibox()->GetText()); |
230 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); | 228 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); |
231 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); | 229 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
232 EXPECT_TRUE(GetSelectionState(&selected)); | 230 EXPECT_TRUE(GetSelectionState(&selected)); |
233 EXPECT_FALSE(selected); | 231 EXPECT_FALSE(selected); |
234 | 232 |
235 // Press Enter. Instant should submit the query "facebook.c". | 233 // Press Enter. Instant should submit the query "facebook.c". |
236 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( | 234 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( |
237 active_tab(), ASCIIToUTF16("facebook.c - Google Search"))); | 235 active_tab(), ASCIIToUTF16("facebook.c - Google Search"))); |
238 } | 236 } |
239 | 237 |
240 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 238 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
241 MANUAL_BackspaceFromUrlToUrlAndNavigate) { | 239 MANUAL_BackspaceFromUrlToUrlAndNavigate) { |
242 set_browser(browser()); | 240 set_browser(browser()); |
243 FocusOmniboxAndWaitForInstantExtendedSupport(); | 241 FocusOmniboxAndWaitForInstantExtendedSupport(); |
244 EXPECT_TRUE(OverlayIsGoogle()); | 242 EXPECT_TRUE(OverlayIsGoogle()); |
245 | 243 |
246 // 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 |
247 // suggest http://www.facebook.com/login.php, the URL. | 245 // suggest http://www.facebook.com/login.php, the URL. |
248 SetOmniboxTextAndWaitForOverlayToShow("facebook.com/"); | 246 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("facebook.com/")); |
249 EXPECT_EQ(ASCIIToUTF16("facebook.com/login.php"), omnibox()->GetText()); | 247 EXPECT_EQ(ASCIIToUTF16("facebook.com/login.php"), omnibox()->GetText()); |
250 EXPECT_EQ(ASCIIToUTF16("login.php"), GetBlueText()); | 248 EXPECT_EQ(ASCIIToUTF16("login.php"), GetBlueText()); |
251 bool selected = false; | 249 bool selected = false; |
252 EXPECT_TRUE(GetSelectionState(&selected)); | 250 EXPECT_TRUE(GetSelectionState(&selected)); |
253 EXPECT_TRUE(selected); | 251 EXPECT_TRUE(selected); |
254 | 252 |
255 // Backspace to the text "facebook.com/". There should be no suggestion text, | 253 // Backspace to the text "facebook.com/". There should be no suggestion text, |
256 // but the first suggestion should be selected. | 254 // but the first suggestion should be selected. |
257 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); | 255 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); |
258 EXPECT_EQ(ASCIIToUTF16("facebook.com/"), omnibox()->GetText()); | 256 EXPECT_EQ(ASCIIToUTF16("facebook.com/"), omnibox()->GetText()); |
(...skipping 10 matching lines...) Expand all Loading... |
269 | 267 |
270 // TODO: http://crbug.com/230537 | 268 // TODO: http://crbug.com/230537 |
271 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 269 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
272 DISABLED_BackspaceFromQueryToSelectedUrlAndNavigate) { | 270 DISABLED_BackspaceFromQueryToSelectedUrlAndNavigate) { |
273 set_browser(browser()); | 271 set_browser(browser()); |
274 FocusOmniboxAndWaitForInstantExtendedSupport(); | 272 FocusOmniboxAndWaitForInstantExtendedSupport(); |
275 EXPECT_TRUE(OverlayIsGoogle()); | 273 EXPECT_TRUE(OverlayIsGoogle()); |
276 | 274 |
277 // 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 |
278 // query [a.copland]. | 276 // query [a.copland]. |
279 SetOmniboxTextAndWaitForOverlayToShow("a.cop"); | 277 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a.cop")); |
280 EXPECT_EQ(ASCIIToUTF16("a.cop"), omnibox()->GetText()); | 278 EXPECT_EQ(ASCIIToUTF16("a.cop"), omnibox()->GetText()); |
281 EXPECT_EQ(ASCIIToUTF16("land"), GetGrayText()); | 279 EXPECT_EQ(ASCIIToUTF16("land"), GetGrayText()); |
282 | 280 |
283 // 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 |
284 // first suggestion should be selected URL "a.co". | 282 // first suggestion should be selected URL "a.co". |
285 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); | 283 EXPECT_TRUE(PressBackspaceAndWaitForSuggestions()); |
286 EXPECT_EQ(ASCIIToUTF16("a.co"), omnibox()->GetText()); | 284 EXPECT_EQ(ASCIIToUTF16("a.co"), omnibox()->GetText()); |
287 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); | 285 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); |
288 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); | 286 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
289 bool selected = false; | 287 bool selected = false; |
290 EXPECT_TRUE(GetSelectionState(&selected)); | 288 EXPECT_TRUE(GetSelectionState(&selected)); |
291 EXPECT_TRUE(selected); | 289 EXPECT_TRUE(selected); |
292 | 290 |
293 // Press Enter. Instant should navigate to a.co/. | 291 // Press Enter. Instant should navigate to a.co/. |
294 PressEnterAndWaitForNavigation(); | 292 PressEnterAndWaitForNavigation(); |
295 EXPECT_TRUE(GetActiveTabURL().DomainIs("amazon.com")); | 293 EXPECT_TRUE(GetActiveTabURL().DomainIs("amazon.com")); |
296 } | 294 } |
297 | 295 |
298 // TODO: http://crbug.com/230491 | 296 // TODO: http://crbug.com/230491 |
299 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 297 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
300 DISABLED_BackspaceFromSelectedUrlToQueryAndSearch) { | 298 DISABLED_BackspaceFromSelectedUrlToQueryAndSearch) { |
301 set_browser(browser()); | 299 set_browser(browser()); |
302 FocusOmniboxAndWaitForInstantExtendedSupport(); | 300 FocusOmniboxAndWaitForInstantExtendedSupport(); |
303 EXPECT_TRUE(OverlayIsGoogle()); | 301 EXPECT_TRUE(OverlayIsGoogle()); |
304 | 302 |
305 // 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/". |
306 SetOmniboxTextAndWaitForOverlayToShow("e.co/"); | 304 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("e.co/")); |
307 EXPECT_EQ(ASCIIToUTF16("e.co/"), omnibox()->GetText()); | 305 EXPECT_EQ(ASCIIToUTF16("e.co/"), omnibox()->GetText()); |
308 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); | 306 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); |
309 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); | 307 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
310 bool selected = false; | 308 bool selected = false; |
311 EXPECT_TRUE(GetSelectionState(&selected)); | 309 EXPECT_TRUE(GetSelectionState(&selected)); |
312 EXPECT_TRUE(selected); | 310 EXPECT_TRUE(selected); |
313 | 311 |
314 // 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]. |
315 EXPECT_TRUE(PressBackspaceAndWaitForOverlayToShow()); | 313 EXPECT_TRUE(PressBackspaceAndWaitForOverlayToShow()); |
316 EXPECT_EQ(ASCIIToUTF16("e.co"), omnibox()->GetText()); | 314 EXPECT_EQ(ASCIIToUTF16("e.co"), omnibox()->GetText()); |
317 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); | 315 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); |
318 EXPECT_EQ(ASCIIToUTF16("li"), GetGrayText()); | 316 EXPECT_EQ(ASCIIToUTF16("li"), GetGrayText()); |
319 selected = true; | 317 selected = true; |
320 EXPECT_TRUE(GetSelectionState(&selected)); | 318 EXPECT_TRUE(GetSelectionState(&selected)); |
321 EXPECT_FALSE(selected); | 319 EXPECT_FALSE(selected); |
322 | 320 |
323 // Press Enter. Instant should search for "e.co". | 321 // Press Enter. Instant should search for "e.co". |
324 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( | 322 EXPECT_TRUE(PressEnterAndWaitForNavigationWithTitle( |
325 instant()->GetOverlayContents(), | 323 instant()->GetOverlayContents(), |
326 ASCIIToUTF16("e.co - Google Search"))); | 324 ASCIIToUTF16("e.co - Google Search"))); |
327 } | 325 } |
328 | 326 |
329 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_TypeURLAndPressEnter) { | 327 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_TypeURLAndPressEnter) { |
330 set_browser(browser()); | 328 set_browser(browser()); |
331 FocusOmniboxAndWaitForInstantExtendedSupport(); | 329 FocusOmniboxAndWaitForInstantExtendedSupport(); |
332 EXPECT_TRUE(OverlayIsGoogle()); | 330 EXPECT_TRUE(OverlayIsGoogle()); |
333 | 331 |
334 // 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 |
335 // facebook.com. | 333 // facebook.com. |
336 SetOmniboxTextAndWaitForOverlayToShow("www.facebook.com"); | 334 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("www.facebook.com")); |
337 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); | 335 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); |
338 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); | 336 EXPECT_EQ(ASCIIToUTF16(""), GetBlueText()); |
339 bool selected = false; | 337 bool selected = false; |
340 EXPECT_TRUE(GetSelectionState(&selected)); | 338 EXPECT_TRUE(GetSelectionState(&selected)); |
341 EXPECT_TRUE(selected); | 339 EXPECT_TRUE(selected); |
342 | 340 |
343 // Press Enter. Should navigate to facebook.com. | 341 // Press Enter. Should navigate to facebook.com. |
344 PressEnterAndWaitForNavigation(); | 342 PressEnterAndWaitForNavigation(); |
345 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); | 343 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); |
346 } | 344 } |
347 | 345 |
| 346 // TODO: http://crbug.com/232088 |
348 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 347 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
349 MANUAL_TypeAutocompletedURLAndPressEnter) { | 348 DISABLED_TypeAutocompletedURLAndPressEnter) { |
350 set_browser(browser()); | 349 set_browser(browser()); |
351 FocusOmniboxAndWaitForInstantExtendedSupport(); | 350 FocusOmniboxAndWaitForInstantExtendedSupport(); |
352 EXPECT_TRUE(OverlayIsGoogle()); | 351 EXPECT_TRUE(OverlayIsGoogle()); |
353 | 352 |
354 // 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 |
355 // www.facebook.com. | 354 // www.facebook.com. |
356 SetOmniboxTextAndWaitForSuggestion("www.facebook."); | 355 SetOmniboxTextAndWaitForSuggestion("www.facebook."); |
357 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); | 356 EXPECT_EQ(ASCIIToUTF16("www.facebook.com"), omnibox()->GetText()); |
358 EXPECT_EQ(ASCIIToUTF16("com"), GetBlueText()); | 357 EXPECT_EQ(ASCIIToUTF16("com"), GetBlueText()); |
359 bool selected = false; | 358 bool selected = false; |
360 EXPECT_TRUE(GetSelectionState(&selected)); | 359 EXPECT_TRUE(GetSelectionState(&selected)); |
361 EXPECT_TRUE(selected); | 360 EXPECT_TRUE(selected); |
362 | 361 |
363 // Press Enter. Should navigate to facebook.com. | 362 // Press Enter. Should navigate to facebook.com. |
364 PressEnterAndWaitForNavigation(); | 363 PressEnterAndWaitForNavigation(); |
365 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); | 364 EXPECT_TRUE(GetActiveTabURL().DomainIs("facebook.com")); |
366 } | 365 } |
367 | 366 |
| 367 // TODO: http://crbug.com/230537 |
368 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, | 368 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, |
369 MANUAL_PasteURLAndPressEnter) { | 369 DISABLED_PasteURLAndPressEnter) { |
370 set_browser(browser()); | 370 set_browser(browser()); |
371 FocusOmniboxAndWaitForInstantExtendedSupport(); | 371 FocusOmniboxAndWaitForInstantExtendedSupport(); |
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 observer.WaitForDesiredOverlayState(); | 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 } |
(...skipping 27 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |