| 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 "chrome/browser/ui/views/search/search_view_controller.h" | 5 #include "chrome/browser/ui/views/search/search_view_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 13 #include "chrome/browser/instant/instant_controller.h" | 13 #include "chrome/browser/instant/instant_controller.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | |
| 15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
| 18 #include "chrome/browser/ui/search/search.h" | 17 #include "chrome/browser/ui/search/search.h" |
| 19 #include "chrome/browser/ui/search/search_model.h" | 18 #include "chrome/browser/ui/search/search_model.h" |
| 20 #include "chrome/browser/ui/search/search_model_observer.h" | 19 #include "chrome/browser/ui/search/search_model_observer.h" |
| 21 #include "chrome/browser/ui/search/search_types.h" | 20 #include "chrome/browser/ui/search/search_types.h" |
| 22 #include "chrome/browser/ui/views/frame/browser_view.h" | 21 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 23 #include "chrome/browser/ui/views/frame/contents_container.h" | 22 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 24 #include "chrome/browser/ui/view_ids.h" | 23 #include "chrome/browser/ui/view_ids.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/pref_names.h" | |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
| 30 | 28 |
| 31 // Currently, the features under test are only enabled under Aura. | 29 // Currently, the features under test are only enabled under Aura. |
| 32 #if defined(USE_AURA) | 30 #if defined(USE_AURA) |
| 33 #define MAYBE(x) x | 31 #define MAYBE(x) x |
| 34 #else | 32 #else |
| 35 #define MAYBE(x) DISABLED_##x | 33 #define MAYBE(x) DISABLED_##x |
| 36 #endif | 34 #endif |
| 37 | 35 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Expect that the |contents_container_| has the overlay set, but no preview. | 211 // Expect that the |contents_container_| has the overlay set, but no preview. |
| 214 ASSERT_TRUE(controller_contents_has_overlay()); | 212 ASSERT_TRUE(controller_contents_has_overlay()); |
| 215 EXPECT_TRUE(controller_contents_overlay_visible()); | 213 EXPECT_TRUE(controller_contents_overlay_visible()); |
| 216 EXPECT_FALSE(controller_contents_has_preview()); | 214 EXPECT_FALSE(controller_contents_has_preview()); |
| 217 } | 215 } |
| 218 | 216 |
| 219 IN_PROC_BROWSER_TEST_F(SearchViewControllerTest, | 217 IN_PROC_BROWSER_TEST_F(SearchViewControllerTest, |
| 220 MAYBE(NTPToInstantSuggestions)) { | 218 MAYBE(NTPToInstantSuggestions)) { |
| 221 AVOID_TEST_ON_BRANDED_CHROME(); | 219 AVOID_TEST_ON_BRANDED_CHROME(); |
| 222 | 220 |
| 223 PrefService* service = browser()->profile()->GetPrefs(); | |
| 224 service->SetBoolean(prefs::kInstantEnabled, true); | |
| 225 EXPECT_TRUE(InstantController::IsInstantEnabled(browser()->profile())); | 221 EXPECT_TRUE(InstantController::IsInstantEnabled(browser()->profile())); |
| 226 | 222 |
| 227 // Initial state. | 223 // Initial state. |
| 228 EXPECT_TRUE(browser()->search_model()->mode().is_default()); | 224 EXPECT_TRUE(browser()->search_model()->mode().is_default()); |
| 229 ASSERT_NE(static_cast<SearchViewController*>(NULL), controller()); | 225 ASSERT_NE(static_cast<SearchViewController*>(NULL), controller()); |
| 230 | 226 |
| 231 // Get to NTP. | 227 // Get to NTP. |
| 232 AddTabAtIndex(0, GURL("chrome://newtab"), content::PAGE_TRANSITION_LINK); | 228 AddTabAtIndex(0, GURL("chrome://newtab"), content::PAGE_TRANSITION_LINK); |
| 233 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); | 229 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); |
| 234 EXPECT_TRUE(controller_state_is_ntp()); | 230 EXPECT_TRUE(controller_state_is_ntp()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 249 // Expect that the |ntp_container_| layer is hidden. | 245 // Expect that the |ntp_container_| layer is hidden. |
| 250 EXPECT_FALSE(controller_ntp_container_is_visible()); | 246 EXPECT_FALSE(controller_ntp_container_is_visible()); |
| 251 | 247 |
| 252 // Expect that the |contents_container_| overlay exists. | 248 // Expect that the |contents_container_| overlay exists. |
| 253 ASSERT_TRUE(controller_contents_has_overlay()); | 249 ASSERT_TRUE(controller_contents_has_overlay()); |
| 254 EXPECT_TRUE(controller_contents_overlay_visible()); | 250 EXPECT_TRUE(controller_contents_overlay_visible()); |
| 255 } | 251 } |
| 256 | 252 |
| 257 } // namespace search | 253 } // namespace search |
| 258 } // namespace chrome | 254 } // namespace chrome |
| OLD | NEW |