Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc

Issue 2177663002: mash: Move ownership of ShelfDelegate to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix wallpaper tests again Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/wm_shell.h"
9 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
10 #include "ash/desktop_background/desktop_background_controller_observer.h" 11 #include "ash/desktop_background/desktop_background_controller_observer.h"
11 #include "ash/desktop_background/desktop_background_controller_test_api.h" 12 #include "ash/desktop_background/desktop_background_controller_test_api.h"
12 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
13 #include "ash/shell.h" 14 #include "ash/shell.h"
14 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
15 #include "ash/test/ash_test_helper.h" 16 #include "ash/test/ash_test_helper.h"
16 #include "ash/test/display_manager_test_api.h" 17 #include "ash/test/display_manager_test_api.h"
17 #include "ash/test/test_user_wallpaper_delegate.h" 18 #include "ash/test/test_user_wallpaper_delegate.h"
18 #include "base/command_line.h" 19 #include "base/command_line.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!base::DirectoryExists(wallpaper_path.DirName())) 112 if (!base::DirectoryExists(wallpaper_path.DirName()))
112 base::CreateDirectory(wallpaper_path.DirName()); 113 base::CreateDirectory(wallpaper_path.DirName());
113 114
114 return wallpaper_path; 115 return wallpaper_path;
115 } 116 }
116 117
117 // Logs in |account_id|. 118 // Logs in |account_id|.
118 void LogIn(const AccountId& account_id, const std::string& user_id_hash) { 119 void LogIn(const AccountId& account_id, const std::string& user_id_hash) {
119 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, 120 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash,
120 false); 121 false);
122 // Adding a secondary display creates a shelf on that display, which
123 // assumes a shelf on the primary display if the user was logged in.
124 ash::Shell::GetInstance()->CreateShelf();
121 WaitAsyncWallpaperLoadStarted(); 125 WaitAsyncWallpaperLoadStarted();
122 } 126 }
123 127
124 // Logs in |account_id| and sets it as child account. 128 // Logs in |account_id| and sets it as child account.
125 void LogInAsChild(const AccountId& account_id, 129 void LogInAsChild(const AccountId& account_id,
126 const std::string& user_id_hash) { 130 const std::string& user_id_hash) {
127 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, 131 user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash,
128 false); 132 false);
129 user_manager::User* user = 133 user_manager::User* user =
130 user_manager::UserManager::Get()->FindUserAndModify(account_id); 134 user_manager::UserManager::Get()->FindUserAndModify(account_id);
131 user_manager::UserManager::Get()->ChangeUserChildStatus( 135 user_manager::UserManager::Get()->ChangeUserChildStatus(
132 user, true /* is_child */); 136 user, true /* is_child */);
137 // TODO(jamescook): For some reason creating the shelf here (which is what
138 // would happen in normal login) causes the child wallpaper tests to fail
139 // with the wallpaper having alpha. This looks like the wallpaper is mid-
140 // animation, but happens even if animations are disabled. Something is
141 // wrong with how these tests simulate login.
133 } 142 }
134 143
135 int LoadedWallpapers() { 144 int LoadedWallpapers() {
136 return WallpaperManager::Get()->loaded_wallpapers_for_test(); 145 return WallpaperManager::Get()->loaded_wallpapers_for_test();
137 } 146 }
138 147
139 void CacheUserWallpaper(const AccountId& account_id) { 148 void CacheUserWallpaper(const AccountId& account_id) {
140 WallpaperManager::Get()->CacheUserWallpaper(account_id); 149 WallpaperManager::Get()->CacheUserWallpaper(account_id);
141 } 150 }
142 151
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 862
854 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 863 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
855 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 864 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
856 865
857 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 866 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
858 controller_->GetWallpaper(), 867 controller_->GetWallpaper(),
859 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 868 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
860 } 869 }
861 870
862 } // namespace chromeos 871 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/extensions/bookmark_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698