OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 EXPECT_TRUE(instant()->IsCurrent()); | 272 EXPECT_TRUE(instant()->IsCurrent()); |
273 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); | 273 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); |
274 | 274 |
275 // Make sure the URL that will get committed when we press <Enter> matches | 275 // Make sure the URL that will get committed when we press <Enter> matches |
276 // that of the default search provider. | 276 // that of the default search provider. |
277 const TemplateURL* default_turl = | 277 const TemplateURL* default_turl = |
278 TemplateURLServiceFactory::GetForProfile(browser()->profile())-> | 278 TemplateURLServiceFactory::GetForProfile(browser()->profile())-> |
279 GetDefaultSearchProvider(); | 279 GetDefaultSearchProvider(); |
280 EXPECT_TRUE(default_turl); | 280 EXPECT_TRUE(default_turl); |
281 EXPECT_EQ(default_turl->url_ref().ReplaceSearchTerms(ASCIIToUTF16("defghi"), | 281 EXPECT_EQ(default_turl->url_ref().ReplaceSearchTerms(ASCIIToUTF16("defghi"), |
282 0, string16()), loader()->url().spec()); | 282 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()), |
| 283 loader()->url().spec()); |
283 | 284 |
284 // Check that the value is reflected and onchange is called. | 285 // Check that the value is reflected and onchange is called. |
285 EXPECT_EQ("true 0 0 1 true d false def false 3 3", | 286 EXPECT_EQ("true 0 0 1 true d false def false 3 3", |
286 GetSearchStateAsString(preview()->web_contents(), false)); | 287 GetSearchStateAsString(preview()->web_contents(), false)); |
287 } | 288 } |
288 | 289 |
289 // Verify that the onsubmit event is dispatched upon pressing <Enter>. | 290 // Verify that the onsubmit event is dispatched upon pressing <Enter>. |
290 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { | 291 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { |
291 ASSERT_TRUE(test_server()->Start()); | 292 ASSERT_TRUE(test_server()->Start()); |
292 EnableInstant(); | 293 EnableInstant(); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 // Press <Enter> in the omnibox, causing the preview to be committed. | 997 // Press <Enter> in the omnibox, causing the preview to be committed. |
997 WebContents* preview_tab = preview()->web_contents(); | 998 WebContents* preview_tab = preview()->web_contents(); |
998 ASSERT_TRUE(PressEnter()); | 999 ASSERT_TRUE(PressEnter()); |
999 | 1000 |
1000 // The preview contents should now be the active tab contents. | 1001 // The preview contents should now be the active tab contents. |
1001 EXPECT_FALSE(preview()); | 1002 EXPECT_FALSE(preview()); |
1002 EXPECT_FALSE(instant()->is_displayable()); | 1003 EXPECT_FALSE(instant()->is_displayable()); |
1003 EXPECT_FALSE(instant()->IsCurrent()); | 1004 EXPECT_FALSE(instant()->IsCurrent()); |
1004 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); | 1005 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); |
1005 } | 1006 } |
OLD | NEW |