| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
| 6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
| 7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 27 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 28 #include "chrome/browser/chromeos/login/wizard_controller.h" | 28 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 29 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 29 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 30 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 30 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 32 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 33 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 33 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 34 #include "chrome/browser/extensions/extension_service.h" | 34 #include "chrome/browser/extensions/extension_service.h" |
| 35 #include "chrome/browser/extensions/extension_test_message_listener.h" | 35 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 36 #include "chrome/browser/profiles/profile_impl.h" | 36 #include "chrome/browser/profiles/profile_impl.h" |
| 37 #include "chrome/browser/profiles/profiles_state.h" |
| 37 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" | 38 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" |
| 38 #include "chrome/common/chrome_constants.h" | 39 #include "chrome/common/chrome_constants.h" |
| 39 #include "chrome/common/chrome_paths.h" | 40 #include "chrome/common/chrome_paths.h" |
| 40 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 42 #include "chromeos/chromeos_switches.h" | 43 #include "chromeos/chromeos_switches.h" |
| 43 #include "chromeos/dbus/cryptohome_client.h" | 44 #include "chromeos/dbus/cryptohome_client.h" |
| 44 #include "components/signin/core/common/signin_pref_names.h" | 45 #include "components/signin/core/common/signin_pref_names.h" |
| 45 #include "content/public/browser/notification_observer.h" | 46 #include "content/public/browser/notification_observer.h" |
| 46 #include "content/public/browser/notification_registrar.h" | 47 #include "content/public/browser/notification_registrar.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); | 425 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); |
| 425 return status; | 426 return status; |
| 426 } | 427 } |
| 427 | 428 |
| 428 // Copies the app profile from |relative_app_profile_dir| from test directory | 429 // Copies the app profile from |relative_app_profile_dir| from test directory |
| 429 // to the app profile directory (assuming "user") under testing profile. This | 430 // to the app profile directory (assuming "user") under testing profile. This |
| 430 // is for that needs to have a kiosk app already installed from a previous | 431 // is for that needs to have a kiosk app already installed from a previous |
| 431 // run. Note this must be called before app profile is loaded. | 432 // run. Note this must be called before app profile is loaded. |
| 432 void SetupAppProfile(const std::string& relative_app_profile_dir) { | 433 void SetupAppProfile(const std::string& relative_app_profile_dir) { |
| 433 base::FilePath app_profile_dir; | 434 base::FilePath app_profile_dir; |
| 434 if (CommandLine::ForCurrentProcess()->HasSwitch( | 435 KioskAppManager::App app_data; |
| 435 ::switches::kMultiProfiles)) { | 436 CHECK(KioskAppManager::Get()->GetApp(test_app_id(), &app_data)); |
| 436 KioskAppManager::App app_data; | 437 std::string app_user_id_hash = |
| 437 CHECK(KioskAppManager::Get()->GetApp(test_app_id(), &app_data)); | 438 CryptohomeClient::GetStubSanitizedUsername(app_data.user_id); |
| 438 std::string app_user_id_hash = | 439 app_profile_dir = |
| 439 CryptohomeClient::GetStubSanitizedUsername(app_data.user_id); | 440 ProfileHelper::GetProfilePathByUserIdHash(app_user_id_hash); |
| 440 app_profile_dir = | |
| 441 ProfileHelper::GetProfilePathByUserIdHash(app_user_id_hash); | |
| 442 } else { | |
| 443 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &app_profile_dir)); | |
| 444 app_profile_dir = app_profile_dir.Append( | |
| 445 ProfileHelper::GetProfileDirByLegacyLoginProfileSwitch()); | |
| 446 } | |
| 447 ASSERT_TRUE(base::CreateDirectory(app_profile_dir)); | 441 ASSERT_TRUE(base::CreateDirectory(app_profile_dir)); |
| 448 | 442 |
| 449 base::FilePath test_data_dir; | 443 base::FilePath test_data_dir; |
| 450 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 444 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
| 451 test_data_dir = test_data_dir.AppendASCII(relative_app_profile_dir); | 445 test_data_dir = test_data_dir.AppendASCII(relative_app_profile_dir); |
| 452 ASSERT_TRUE( | 446 ASSERT_TRUE( |
| 453 base::CopyFile(test_data_dir.Append(chrome::kPreferencesFilename), | 447 base::CopyFile(test_data_dir.Append(chrome::kPreferencesFilename), |
| 454 app_profile_dir.Append(chrome::kPreferencesFilename))); | 448 app_profile_dir.Append(chrome::kPreferencesFilename))); |
| 455 ASSERT_TRUE( | 449 ASSERT_TRUE( |
| 456 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"), | 450 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"), |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 content::WindowedNotificationObserver( | 1196 content::WindowedNotificationObserver( |
| 1203 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1197 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1204 content::NotificationService::AllSources()).Wait(); | 1198 content::NotificationService::AllSources()).Wait(); |
| 1205 | 1199 |
| 1206 // Wait for the wallpaper to load. | 1200 // Wait for the wallpaper to load. |
| 1207 WaitForWallpaper(); | 1201 WaitForWallpaper(); |
| 1208 EXPECT_TRUE(wallpaper_loaded()); | 1202 EXPECT_TRUE(wallpaper_loaded()); |
| 1209 } | 1203 } |
| 1210 | 1204 |
| 1211 } // namespace chromeos | 1205 } // namespace chromeos |
| OLD | NEW |