| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 724 } |
| 725 | 725 |
| 726 // Tests that instant search is preloaded whenever the omnibox gets focus. | 726 // Tests that instant search is preloaded whenever the omnibox gets focus. |
| 727 // PreloadsInstant fails on linux_chromeos trybots all the time, possibly | 727 // PreloadsInstant fails on linux_chromeos trybots all the time, possibly |
| 728 // because of http://crbug.com/80118. | 728 // because of http://crbug.com/80118. |
| 729 #if defined(OS_CHROMEOS) | 729 #if defined(OS_CHROMEOS) |
| 730 IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_PreloadsInstant) { | 730 IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_PreloadsInstant) { |
| 731 #else | 731 #else |
| 732 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PreloadsInstant)) { | 732 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PreloadsInstant)) { |
| 733 #endif | 733 #endif |
| 734 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 735 switches::kPreloadInstantSearch); | |
| 736 ASSERT_TRUE(test_server()->Start()); | 734 ASSERT_TRUE(test_server()->Start()); |
| 737 EnableInstant(); | 735 EnableInstant(); |
| 738 SetupInstantProvider("instant.html"); | 736 SetupInstantProvider("instant.html"); |
| 739 | 737 |
| 740 // The omnibox gets focus before the test begins. At that time, there was no | 738 // The omnibox gets focus before the test begins. At that time, there was no |
| 741 // instant controller (which was only created after EnableInstant()), so no | 739 // instant controller (which was only created after EnableInstant()), so no |
| 742 // preloading happened. Unfocus the omnibox with ClickOnView(), so that when | 740 // preloading happened. Unfocus the omnibox with ClickOnView(), so that when |
| 743 // we focus it again, the controller will preload instant search. | 741 // we focus it again, the controller will preload instant search. |
| 744 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 742 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 745 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 743 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 // Press <Enter> in the omnibox, causing the preview to be committed. | 1001 // Press <Enter> in the omnibox, causing the preview to be committed. |
| 1004 WebContents* preview_tab = preview()->web_contents(); | 1002 WebContents* preview_tab = preview()->web_contents(); |
| 1005 ASSERT_TRUE(PressEnter()); | 1003 ASSERT_TRUE(PressEnter()); |
| 1006 | 1004 |
| 1007 // The preview contents should now be the active tab contents. | 1005 // The preview contents should now be the active tab contents. |
| 1008 EXPECT_FALSE(preview()); | 1006 EXPECT_FALSE(preview()); |
| 1009 EXPECT_FALSE(instant()->is_displayable()); | 1007 EXPECT_FALSE(instant()->is_displayable()); |
| 1010 EXPECT_FALSE(instant()->IsCurrent()); | 1008 EXPECT_FALSE(instant()->IsCurrent()); |
| 1011 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); | 1009 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); |
| 1012 } | 1010 } |
| OLD | NEW |