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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
16 #include "chrome/browser/ui/app_list/app_list_service.h" | 16 #include "chrome/browser/ui/app_list/app_list_service.h" |
17 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" | 17 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "chromeos/chromeos_switches.h" |
| 25 #include "components/user_manager/user_names.h" |
24 #include "ui/app_list/app_list_model.h" | 26 #include "ui/app_list/app_list_model.h" |
25 #include "ui/app_list/app_list_switches.h" | 27 #include "ui/app_list/app_list_switches.h" |
26 #include "ui/app_list/search_box_model.h" | 28 #include "ui/app_list/search_box_model.h" |
27 #include "ui/app_list/search_result.h" | 29 #include "ui/app_list/search_result.h" |
28 #include "ui/app_list/search_result_observer.h" | 30 #include "ui/app_list/search_result_observer.h" |
29 #include "ui/base/models/list_model_observer.h" | 31 #include "ui/base/models/list_model_observer.h" |
30 | 32 |
31 #if defined(OS_CHROMEOS) | |
32 #include "chromeos/chromeos_switches.h" | |
33 #include "components/user_manager/user_names.h" | |
34 #endif // defined(OS_CHROMEOS) | |
35 | |
36 // Browser Test for AppListController that runs on all platforms supporting | 33 // Browser Test for AppListController that runs on all platforms supporting |
37 // app_list. | 34 // app_list. |
38 typedef InProcessBrowserTest AppListControllerBrowserTest; | 35 typedef InProcessBrowserTest AppListControllerBrowserTest; |
39 | 36 |
40 // Test the CreateNewWindow function of the controller delegate. | 37 // Test the CreateNewWindow function of the controller delegate. |
41 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { | 38 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { |
42 AppListService* service = AppListService::Get(); | 39 AppListService* service = AppListService::Get(); |
43 AppListControllerDelegate* controller(service->GetControllerDelegate()); | 40 AppListControllerDelegate* controller(service->GetControllerDelegate()); |
44 ASSERT_TRUE(controller); | 41 ASSERT_TRUE(controller); |
45 | 42 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 UninstallExtension(extension->id()); | 155 UninstallExtension(extension->id()); |
159 | 156 |
160 // Allow async AppSearchProvider::UpdateResults to run. | 157 // Allow async AppSearchProvider::UpdateResults to run. |
161 base::RunLoop().RunUntilIdle(); | 158 base::RunLoop().RunUntilIdle(); |
162 | 159 |
163 EXPECT_FALSE(observed_result_); | 160 EXPECT_FALSE(observed_result_); |
164 StopWatchingResults(); | 161 StopWatchingResults(); |
165 service->DismissAppList(); | 162 service->DismissAppList(); |
166 } | 163 } |
167 | 164 |
168 #if defined(OS_CHROMEOS) | |
169 | |
170 class AppListControllerGuestModeBrowserTest : public InProcessBrowserTest { | 165 class AppListControllerGuestModeBrowserTest : public InProcessBrowserTest { |
171 public: | 166 public: |
172 AppListControllerGuestModeBrowserTest() {} | 167 AppListControllerGuestModeBrowserTest() {} |
173 | 168 |
174 protected: | 169 protected: |
175 void SetUpCommandLine(base::CommandLine* command_line) override; | 170 void SetUpCommandLine(base::CommandLine* command_line) override; |
176 | 171 |
177 private: | 172 private: |
178 DISALLOW_COPY_AND_ASSIGN(AppListControllerGuestModeBrowserTest); | 173 DISALLOW_COPY_AND_ASSIGN(AppListControllerGuestModeBrowserTest); |
179 }; | 174 }; |
180 | 175 |
181 void AppListControllerGuestModeBrowserTest::SetUpCommandLine( | 176 void AppListControllerGuestModeBrowserTest::SetUpCommandLine( |
182 base::CommandLine* command_line) { | 177 base::CommandLine* command_line) { |
183 command_line->AppendSwitch(chromeos::switches::kGuestSession); | 178 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
184 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 179 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
185 user_manager::kGuestUserName); | 180 user_manager::kGuestUserName); |
186 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, | 181 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
187 TestingProfile::kTestUserProfileDir); | 182 TestingProfile::kTestUserProfileDir); |
188 command_line->AppendSwitch(switches::kIncognito); | 183 command_line->AppendSwitch(switches::kIncognito); |
189 } | 184 } |
190 | 185 |
191 // Test creating the initial app list in guest mode. | 186 // Test creating the initial app list in guest mode. |
192 IN_PROC_BROWSER_TEST_F(AppListControllerGuestModeBrowserTest, Incognito) { | 187 IN_PROC_BROWSER_TEST_F(AppListControllerGuestModeBrowserTest, Incognito) { |
193 AppListService* service = AppListService::Get(); | 188 AppListService* service = AppListService::Get(); |
194 EXPECT_TRUE(service->GetCurrentAppListProfile()); | 189 EXPECT_TRUE(service->GetCurrentAppListProfile()); |
195 | 190 |
196 service->ShowForProfile(browser()->profile()); | 191 service->ShowForProfile(browser()->profile()); |
197 EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile()); | 192 EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile()); |
198 } | 193 } |
199 | |
200 #endif // defined(OS_CHROMEOS) | |
OLD | NEW |