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

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

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase Created 3 years, 9 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/wallpaper/wallpaper_controller.h" 9 #include "ash/common/wallpaper/wallpaper_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u tils.h" 22 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u tils.h"
23 #include "chrome/browser/ui/ash/session_controller_client.h"
23 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/testing_browser_process.h" 26 #include "chrome/test/base/testing_browser_process.h"
26 #include "chromeos/chromeos_switches.h" 27 #include "chromeos/chromeos_switches.h"
27 #include "components/prefs/scoped_user_pref_update.h" 28 #include "components/prefs/scoped_user_pref_update.h"
28 #include "components/session_manager/core/session_manager.h" 29 #include "components/session_manager/core/session_manager.h"
29 #include "components/signin/core/account_id/account_id.h" 30 #include "components/signin/core/account_id/account_id.h"
30 #include "components/user_manager/user.h" 31 #include "components/user_manager/user.h"
31 #include "components/user_manager/user_manager.h" 32 #include "components/user_manager/user_manager.h"
32 #include "components/user_manager/user_names.h" 33 #include "components/user_manager/user_names.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 wallpaper_files_id, id); 109 wallpaper_files_id, id);
109 if (!base::DirectoryExists(wallpaper_path.DirName())) 110 if (!base::DirectoryExists(wallpaper_path.DirName()))
110 base::CreateDirectory(wallpaper_path.DirName()); 111 base::CreateDirectory(wallpaper_path.DirName());
111 112
112 return wallpaper_path; 113 return wallpaper_path;
113 } 114 }
114 115
115 // Logs in |account_id|. 116 // Logs in |account_id|.
116 void LogIn(const AccountId& account_id, const std::string& user_id_hash) { 117 void LogIn(const AccountId& account_id, const std::string& user_id_hash) {
117 SessionManager::Get()->CreateSession(account_id, user_id_hash); 118 SessionManager::Get()->CreateSession(account_id, user_id_hash);
118 // Adding a secondary display creates a shelf on that display, which 119 SessionManager::Get()->SessionStarted();
119 // assumes a shelf on the primary display if the user was logged in. 120 // Flush to ensure the created session and ACTIVE state reaches ash.
120 ash::WmShell::Get()->CreateShelfView(); 121 SessionControllerClient::FlushForTesting();
xiyuan 2017/03/17 07:08:16 This would cause shelf to be created now.
James Cook 2017/03/17 17:14:37 Acknowledged. Aside, not related to this CL: I've
xiyuan 2017/03/17 22:52:03 I have not looked at how wallpaper is migrated to
121 WaitAsyncWallpaperLoadStarted(); 122 WaitAsyncWallpaperLoadStarted();
122 } 123 }
123 124
124 // Logs in |account_id| and sets it as child account. 125 // Logs 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 SessionManager::Get()->CreateSession(account_id, user_id_hash); 128 SessionManager::Get()->CreateSession(account_id, user_id_hash);
128 user_manager::User* user = 129 user_manager::User* user =
129 user_manager::UserManager::Get()->FindUserAndModify(account_id); 130 user_manager::UserManager::Get()->FindUserAndModify(account_id);
130 user_manager::UserManager::Get()->ChangeUserChildStatus( 131 user_manager::UserManager::Get()->ChangeUserChildStatus(
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 826
826 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 827 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
827 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 828 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
828 829
829 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 830 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
830 controller_->GetWallpaper(), 831 controller_->GetWallpaper(),
831 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 832 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
832 } 833 }
833 834
834 } // namespace chromeos 835 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698