Chromium Code Reviews| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_util.h" | 11 #include "chrome/browser/ui/app_list_service.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
| 17 | 17 |
| 18 | |
| 19 // Browser Test for AppListController that runs on all platforms supporting | 18 // Browser Test for AppListController that runs on all platforms supporting |
| 20 // app_list. | 19 // app_list. |
| 21 class AppListControllerBrowserTest : public InProcessBrowserTest { | 20 class AppListControllerBrowserTest : public InProcessBrowserTest { |
| 22 public: | 21 public: |
| 23 AppListControllerBrowserTest() | 22 AppListControllerBrowserTest() |
| 24 : profile2_(NULL) {} | 23 : profile2_(NULL) {} |
| 25 | 24 |
| 26 void OnProfileCreated(Profile* profile, Profile::CreateStatus status) { | 25 void OnProfileCreated(Profile* profile, Profile::CreateStatus status) { |
| 27 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 26 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| 28 profile2_ = profile; | 27 profile2_ = profile; |
| 29 MessageLoop::current()->Quit(); | 28 MessageLoop::current()->Quit(); |
| 30 } | 29 } |
| 31 } | 30 } |
| 32 | 31 |
| 33 protected: | 32 protected: |
| 34 base::ScopedTempDir temp_profile_dir_; | 33 base::ScopedTempDir temp_profile_dir_; |
| 35 Profile* profile2_; | 34 Profile* profile2_; |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(AppListControllerBrowserTest); | 37 DISALLOW_COPY_AND_ASSIGN(AppListControllerBrowserTest); |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 #if defined(OS_WIN) && !defined(USE_AURA) | 40 #if defined(OS_WIN) && !defined(USE_AURA) |
| 42 // Show the app list, then dismiss it. | 41 // Show the app list, then dismiss it. |
| 43 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, ShowAndDismiss) { | 42 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, ShowAndDismiss) { |
| 44 ASSERT_FALSE(chrome::IsAppListVisible()); | 43 ASSERT_FALSE(chrome::IsAppListVisible()); |
|
tapted
2013/02/11 04:04:20
these all need to become, e.g.,
AppListService::G
tapted
2013/02/19 03:15:32
Done.
| |
| 45 chrome::ShowAppList(browser()->profile()); | 44 chrome::ShowAppList(browser()->profile()); |
| 46 ASSERT_TRUE(chrome::IsAppListVisible()); | 45 ASSERT_TRUE(chrome::IsAppListVisible()); |
| 47 chrome::DismissAppList(); | 46 chrome::DismissAppList(); |
| 48 ASSERT_FALSE(chrome::IsAppListVisible()); | 47 ASSERT_FALSE(chrome::IsAppListVisible()); |
| 49 } | 48 } |
| 50 | 49 |
| 51 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, SwitchAppListProfiles) { | 50 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, SwitchAppListProfiles) { |
| 52 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 51 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 53 ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); | 52 ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); |
| 54 profile_manager->CreateProfileAsync( | 53 profile_manager->CreateProfileAsync( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // switches::kShowAppList. | 85 // switches::kShowAppList. |
| 87 ASSERT_TRUE(chrome::IsAppListVisible()); | 86 ASSERT_TRUE(chrome::IsAppListVisible()); |
| 88 | 87 |
| 89 // Create a browser to prevent shutdown when we dismiss the app list. We | 88 // Create a browser to prevent shutdown when we dismiss the app list. We |
| 90 // need to do this because switches::kShowAppList suppresses the creation of | 89 // need to do this because switches::kShowAppList suppresses the creation of |
| 91 // any browsers. | 90 // any browsers. |
| 92 CreateBrowser(chrome::GetCurrentAppListProfile()); | 91 CreateBrowser(chrome::GetCurrentAppListProfile()); |
| 93 chrome::DismissAppList(); | 92 chrome::DismissAppList(); |
| 94 } | 93 } |
| 95 #endif // defined(OS_WIN) && !defined(USE_AURA) | 94 #endif // defined(OS_WIN) && !defined(USE_AURA) |
| OLD | NEW |