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/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 11 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
12 #include "chrome/browser/ui/app_list/app_list_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_service.h" |
13 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" | 13 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/host_desktop.h" | 16 #include "chrome/browser/ui/host_desktop.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chrome/test/base/testing_profile.h" |
19 #include "ui/app_list/app_list_model.h" | 21 #include "ui/app_list/app_list_model.h" |
20 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
21 #include "ui/app_list/search_box_model.h" | 23 #include "ui/app_list/search_box_model.h" |
22 #include "ui/app_list/search_result.h" | 24 #include "ui/app_list/search_result.h" |
23 #include "ui/app_list/search_result_observer.h" | 25 #include "ui/app_list/search_result_observer.h" |
24 #include "ui/base/models/list_model_observer.h" | 26 #include "ui/base/models/list_model_observer.h" |
25 | 27 |
| 28 #if defined(OS_CHROMEOS) |
| 29 #include "chromeos/chromeos_switches.h" |
| 30 #include "chromeos/login/user_names.h" |
| 31 #endif // defined(OS_CHROMEOS) |
| 32 |
26 // Browser Test for AppListController that runs on all platforms supporting | 33 // Browser Test for AppListController that runs on all platforms supporting |
27 // app_list. | 34 // app_list. |
28 typedef InProcessBrowserTest AppListControllerBrowserTest; | 35 typedef InProcessBrowserTest AppListControllerBrowserTest; |
29 | 36 |
30 // Test the CreateNewWindow function of the controller delegate. | 37 // Test the CreateNewWindow function of the controller delegate. |
31 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { | 38 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { |
32 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); | 39 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); |
33 AppListService* service = test::GetAppListService(); | 40 AppListService* service = test::GetAppListService(); |
34 AppListControllerDelegate* controller(service->GetControllerDelegate()); | 41 AppListControllerDelegate* controller(service->GetControllerDelegate()); |
35 ASSERT_TRUE(controller); | 42 ASSERT_TRUE(controller); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // Now uninstall and ensure this browser test observes it. | 212 // Now uninstall and ensure this browser test observes it. |
206 UninstallExtension(extension->id()); | 213 UninstallExtension(extension->id()); |
207 | 214 |
208 // Allow async AppSearchProvider::UpdateResults to run. | 215 // Allow async AppSearchProvider::UpdateResults to run. |
209 base::RunLoop().RunUntilIdle(); | 216 base::RunLoop().RunUntilIdle(); |
210 | 217 |
211 EXPECT_FALSE(observed_result_); | 218 EXPECT_FALSE(observed_result_); |
212 StopWatchingResults(); | 219 StopWatchingResults(); |
213 service->DismissAppList(); | 220 service->DismissAppList(); |
214 } | 221 } |
| 222 |
| 223 #if defined(OS_CHROMEOS) |
| 224 |
| 225 class AppListControllerGuestModeBrowserTest : public InProcessBrowserTest { |
| 226 public: |
| 227 AppListControllerGuestModeBrowserTest() {} |
| 228 |
| 229 protected: |
| 230 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 231 |
| 232 private: |
| 233 DISALLOW_COPY_AND_ASSIGN(AppListControllerGuestModeBrowserTest); |
| 234 }; |
| 235 |
| 236 void AppListControllerGuestModeBrowserTest::SetUpCommandLine( |
| 237 base::CommandLine* command_line) { |
| 238 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
| 239 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
| 240 chromeos::login::kGuestUserName); |
| 241 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 242 TestingProfile::kTestUserProfileDir); |
| 243 command_line->AppendSwitch(switches::kIncognito); |
| 244 } |
| 245 |
| 246 // Test creating the initial app list in guest mode. |
| 247 IN_PROC_BROWSER_TEST_F(AppListControllerGuestModeBrowserTest, Incognito) { |
| 248 AppListService* service = test::GetAppListService(); |
| 249 EXPECT_TRUE(service->GetCurrentAppListProfile()); |
| 250 |
| 251 service->ShowForProfile(browser()->profile()); |
| 252 EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile()); |
| 253 } |
| 254 |
| 255 #endif // defined(OS_CHROMEOS) |
OLD | NEW |