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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 EXPECT_TRUE(instant()->is_displayable()); | 275 EXPECT_TRUE(instant()->is_displayable()); |
276 EXPECT_TRUE(instant()->IsCurrent()); | 276 EXPECT_TRUE(instant()->IsCurrent()); |
277 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); | 277 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); |
278 | 278 |
279 // Make sure the URL that will get committed when we press <Enter> matches | 279 // Make sure the URL that will get committed when we press <Enter> matches |
280 // that of the default search provider. | 280 // that of the default search provider. |
281 const TemplateURL* default_turl = | 281 const TemplateURL* default_turl = |
282 TemplateURLServiceFactory::GetForProfile(browser()->profile())-> | 282 TemplateURLServiceFactory::GetForProfile(browser()->profile())-> |
283 GetDefaultSearchProvider(); | 283 GetDefaultSearchProvider(); |
284 EXPECT_TRUE(default_turl); | 284 EXPECT_TRUE(default_turl); |
285 EXPECT_EQ(default_turl->url_ref().ReplaceSearchTerms(ASCIIToUTF16("defghi"), | 285 EXPECT_TRUE(default_turl->url()); |
286 0, string16()), loader()->url().spec()); | 286 EXPECT_EQ(default_turl->url()->ReplaceSearchTerms(ASCIIToUTF16("defghi"), 0, |
| 287 string16()), loader()->url().spec()); |
287 | 288 |
288 // Check that the value is reflected and onchange is called. | 289 // Check that the value is reflected and onchange is called. |
289 EXPECT_EQ("true 0 0 1 true d false def false 3 3", | 290 EXPECT_EQ("true 0 0 1 true d false def false 3 3", |
290 GetSearchStateAsString(preview()->web_contents(), false)); | 291 GetSearchStateAsString(preview()->web_contents(), false)); |
291 } | 292 } |
292 | 293 |
293 // Verify that the onsubmit event is dispatched upon pressing <Enter>. | 294 // Verify that the onsubmit event is dispatched upon pressing <Enter>. |
294 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { | 295 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { |
295 ASSERT_TRUE(test_server()->Start()); | 296 ASSERT_TRUE(test_server()->Start()); |
296 EnableInstant(); | 297 EnableInstant(); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 // Press <Enter> in the omnibox, causing the preview to be committed. | 1001 // Press <Enter> in the omnibox, causing the preview to be committed. |
1001 WebContents* preview_tab = preview()->web_contents(); | 1002 WebContents* preview_tab = preview()->web_contents(); |
1002 ASSERT_TRUE(PressEnter()); | 1003 ASSERT_TRUE(PressEnter()); |
1003 | 1004 |
1004 // The preview contents should now be the active tab contents. | 1005 // The preview contents should now be the active tab contents. |
1005 EXPECT_FALSE(preview()); | 1006 EXPECT_FALSE(preview()); |
1006 EXPECT_FALSE(instant()->is_displayable()); | 1007 EXPECT_FALSE(instant()->is_displayable()); |
1007 EXPECT_FALSE(instant()->IsCurrent()); | 1008 EXPECT_FALSE(instant()->IsCurrent()); |
1008 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); | 1009 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); |
1009 } | 1010 } |
OLD | NEW |