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/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/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "ui/app_list/app_list_model.h" | 19 #include "ui/app_list/app_list_model.h" |
| 20 #include "ui/app_list/app_list_switches.h" | 20 #include "ui/app_list/app_list_switches.h" |
| 21 #include "ui/app_list/search_box_model.h" | 21 #include "ui/app_list/search_box_model.h" |
| 22 #include "ui/app_list/search_result.h" | 22 #include "ui/app_list/search_result.h" |
| 23 #include "ui/app_list/search_result_observer.h" | 23 #include "ui/app_list/search_result_observer.h" |
| 24 #include "ui/base/models/list_model_observer.h" | 24 #include "ui/base/models/list_model_observer.h" |
| 25 | 25 |
| 26 #if defined(OS_CHROMEOS) | |
| 27 #include "chrome/browser/chromeos/login/chrome_restart_request.h" | |
| 28 #include "chromeos/chromeos_switches.h" | |
| 29 | |
| 30 namespace { | |
| 31 | |
| 32 GURL GetGoogleURL() { | |
| 33 return GURL("http://www.google.com/"); | |
| 34 } | |
| 35 | |
| 36 } // namespace | |
| 37 | |
| 38 #endif // defined(OS_CHROMEOS) | |
| 39 | |
| 26 // Browser Test for AppListController that runs on all platforms supporting | 40 // Browser Test for AppListController that runs on all platforms supporting |
| 27 // app_list. | 41 // app_list. |
| 28 typedef InProcessBrowserTest AppListControllerBrowserTest; | 42 typedef InProcessBrowserTest AppListControllerBrowserTest; |
| 29 | 43 |
| 30 // Test the CreateNewWindow function of the controller delegate. | 44 // Test the CreateNewWindow function of the controller delegate. |
| 31 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { | 45 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { |
| 32 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); | 46 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); |
| 33 AppListService* service = test::GetAppListService(); | 47 AppListService* service = test::GetAppListService(); |
| 34 AppListControllerDelegate* controller(service->GetControllerDelegate()); | 48 AppListControllerDelegate* controller(service->GetControllerDelegate()); |
| 35 ASSERT_TRUE(controller); | 49 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. | 219 // Now uninstall and ensure this browser test observes it. |
| 206 UninstallExtension(extension->id()); | 220 UninstallExtension(extension->id()); |
| 207 | 221 |
| 208 // Allow async AppSearchProvider::UpdateResults to run. | 222 // Allow async AppSearchProvider::UpdateResults to run. |
| 209 base::RunLoop().RunUntilIdle(); | 223 base::RunLoop().RunUntilIdle(); |
| 210 | 224 |
| 211 EXPECT_FALSE(observed_result_); | 225 EXPECT_FALSE(observed_result_); |
| 212 StopWatchingResults(); | 226 StopWatchingResults(); |
| 213 service->DismissAppList(); | 227 service->DismissAppList(); |
| 214 } | 228 } |
| 229 | |
| 230 #if defined(OS_CHROMEOS) | |
| 231 | |
| 232 class AppListControllerGuestModeBrowserTest : public InProcessBrowserTest { | |
| 233 protected: | |
| 234 void SetUpCommandLine(base::CommandLine* command_line) override; | |
| 235 }; | |
|
tapted
2015/03/04 05:01:10
nit: DISALLOW_COPY_AND_ASSIGN -- you'll need defa
Matt Giuca
2015/03/04 06:07:05
Done.
| |
| 236 | |
| 237 void AppListControllerGuestModeBrowserTest::SetUpCommandLine( | |
| 238 base::CommandLine* command_line) { | |
| 239 base::CommandLine command_line_copy = *command_line; | |
| 240 command_line_copy.AppendSwitchASCII(chromeos::switches::kLoginProfile, | |
| 241 "user"); | |
|
tapted
2015/03/04 05:01:10
"user" -> TestingProfile::kTestUserProfileDir ?
Matt Giuca
2015/03/04 06:07:05
Done.
| |
| 242 command_line_copy.AppendSwitch(chromeos::switches::kGuestSession); | |
| 243 chromeos::GetOffTheRecordCommandLine(GetGoogleURL(), true, command_line_copy, | |
|
tapted
2015/03/04 05:01:10
Can `GetOffTheRecordCommandLine` be cut out of the
Matt Giuca
2015/03/04 06:07:05
Yeah, I replaced this with the code from guest_mod
| |
| 244 command_line); | |
| 245 } | |
| 246 | |
| 247 // Test creating the initial app list in guest mode. | |
| 248 IN_PROC_BROWSER_TEST_F(AppListControllerGuestModeBrowserTest, Incognito) { | |
| 249 AppListService* service = test::GetAppListService(); | |
| 250 EXPECT_TRUE(service->GetCurrentAppListProfile()); | |
| 251 | |
| 252 service->ShowForProfile(browser()->profile()); | |
| 253 EXPECT_EQ(browser()->profile(), service->GetCurrentAppListProfile()); | |
| 254 } | |
| 255 | |
| 256 #endif // defined(OS_CHROMEOS) | |
| OLD | NEW |