Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/desktop_background/desktop_background_controller.h" | 9 #include "ash/desktop_background/desktop_background_controller.h" |
| 10 #include "ash/desktop_background/desktop_background_controller_observer.h" | 10 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 const std::string& id) { | 107 const std::string& id) { |
| 108 base::FilePath wallpaper_path = | 108 base::FilePath wallpaper_path = |
| 109 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, | 109 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, |
| 110 wallpaper_files_id, id); | 110 wallpaper_files_id, id); |
| 111 if (!base::DirectoryExists(wallpaper_path.DirName())) | 111 if (!base::DirectoryExists(wallpaper_path.DirName())) |
| 112 base::CreateDirectory(wallpaper_path.DirName()); | 112 base::CreateDirectory(wallpaper_path.DirName()); |
| 113 | 113 |
| 114 return wallpaper_path; | 114 return wallpaper_path; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Logs in |account_id|. | 117 // Simulates logging in |account_id|. |
| 118 void LogIn(const AccountId& account_id, const std::string& user_id_hash) { | 118 void LogIn(const AccountId& account_id, const std::string& user_id_hash) { |
| 119 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, | 119 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, |
| 120 false); | 120 false); |
| 121 ash::Shell::GetInstance()->CreateShelf(); | |
|
James Cook
2016/07/22 23:37:00
I went with manually creating the shelf, rather th
msw
2016/07/23 00:02:37
Would WmShell::SetShelfDelegateForTesting suffice
James Cook
2016/07/23 00:38:03
Done.
| |
| 121 WaitAsyncWallpaperLoadStarted(); | 122 WaitAsyncWallpaperLoadStarted(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 // Logs in |account_id| and sets it as child account. | 125 // Simulates logging in |account_id| and sets it as child account. |
| 125 void LogInAsChild(const AccountId& account_id, | 126 void LogInAsChild(const AccountId& account_id, |
| 126 const std::string& user_id_hash) { | 127 const std::string& user_id_hash) { |
| 127 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, | 128 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, |
| 128 false); | 129 false); |
| 129 user_manager::User* user = | 130 user_manager::User* user = |
| 130 user_manager::UserManager::Get()->FindUserAndModify(account_id); | 131 user_manager::UserManager::Get()->FindUserAndModify(account_id); |
| 131 user_manager::UserManager::Get()->ChangeUserChildStatus( | 132 user_manager::UserManager::Get()->ChangeUserChildStatus( |
| 132 user, true /* is_child */); | 133 user, true /* is_child */); |
| 134 ash::Shell::GetInstance()->CreateShelf(); | |
| 133 } | 135 } |
| 134 | 136 |
| 135 int LoadedWallpapers() { | 137 int LoadedWallpapers() { |
| 136 return WallpaperManager::Get()->loaded_wallpapers_for_test(); | 138 return WallpaperManager::Get()->loaded_wallpapers_for_test(); |
| 137 } | 139 } |
| 138 | 140 |
| 139 void CacheUserWallpaper(const AccountId& account_id) { | 141 void CacheUserWallpaper(const AccountId& account_id) { |
| 140 WallpaperManager::Get()->CacheUserWallpaper(account_id); | 142 WallpaperManager::Get()->CacheUserWallpaper(account_id); |
| 141 } | 143 } |
| 142 | 144 |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 | 855 |
| 854 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); | 856 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); |
| 855 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 857 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 856 | 858 |
| 857 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 859 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
| 858 controller_->GetWallpaper(), | 860 controller_->GetWallpaper(), |
| 859 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); | 861 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); |
| 860 } | 862 } |
| 861 | 863 |
| 862 } // namespace chromeos | 864 } // namespace chromeos |
| OLD | NEW |