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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/wallpaper_private_api.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
12 #include "ash/test/test_session_state_delegate.h"
13 #include "ash/test/test_shell_delegate.h" 11 #include "ash/test/test_shell_delegate.h"
14 #include "ash/wm/window_state_aura.h" 12 #include "ash/wm/window_state_aura.h"
15 #include "base/command_line.h" 13 #include "base/command_line.h"
16 #include "base/macros.h" 14 #include "base/macros.h"
17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 15 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
21 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 19 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
22 #include "components/signin/core/account_id/account_id.h" 20 #include "components/signin/core/account_id/account_id.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 window0.reset(); 162 window0.reset();
165 EXPECT_TRUE(RunRestoreFunction()); 163 EXPECT_TRUE(RunRestoreFunction());
166 164
167 // Windows 1 should no longer be minimized. 165 // Windows 1 should no longer be minimized.
168 EXPECT_FALSE(window1_state->IsMinimized()); 166 EXPECT_FALSE(window1_state->IsMinimized());
169 } 167 }
170 168
171 class WallpaperPrivateApiMultiUserUnittest 169 class WallpaperPrivateApiMultiUserUnittest
172 : public WallpaperPrivateApiUnittest { 170 : public WallpaperPrivateApiUnittest {
173 public: 171 public:
174 WallpaperPrivateApiMultiUserUnittest() 172 WallpaperPrivateApiMultiUserUnittest(): multi_user_window_manager_(nullptr) {}
175 : multi_user_window_manager_(NULL),
176 session_state_delegate_(NULL) {}
177 173
178 void SetUp() override; 174 void SetUp() override;
179 void TearDown() override; 175 void TearDown() override;
180 176
181 protected: 177 protected:
182 void SetUpMultiUserWindowManager( 178 void SetUpMultiUserWindowManager(
183 const AccountId& active_account_id, 179 const AccountId& active_account_id,
184 chrome::MultiUserWindowManager::MultiProfileMode mode); 180 chrome::MultiUserWindowManager::MultiProfileMode mode);
185 181
186 void SwitchActiveUser(const AccountId& active_account_id); 182 void SwitchActiveUser(const AccountId& active_account_id);
187 183
188 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager() { 184 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager() {
189 return multi_user_window_manager_; 185 return multi_user_window_manager_;
190 } 186 }
191 187
192 private: 188 private:
193 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_; 189 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_;
194 ash::test::TestSessionStateDelegate* session_state_delegate_;
195 190
196 DISALLOW_COPY_AND_ASSIGN(WallpaperPrivateApiMultiUserUnittest); 191 DISALLOW_COPY_AND_ASSIGN(WallpaperPrivateApiMultiUserUnittest);
197 }; 192 };
198 193
199 void WallpaperPrivateApiMultiUserUnittest::SetUp() { 194 void WallpaperPrivateApiMultiUserUnittest::SetUp() {
200 AshTestBase::SetUp(); 195 AshTestBase::SetUp();
201 WallpaperManager::Initialize(); 196 WallpaperManager::Initialize();
202 session_state_delegate_ =
203 static_cast<ash::test::TestSessionStateDelegate*> (
204 ash::Shell::GetInstance()->session_state_delegate());
205 fake_user_manager()->AddUser(test_account_id1_); 197 fake_user_manager()->AddUser(test_account_id1_);
206 fake_user_manager()->AddUser(test_account_id2_); 198 fake_user_manager()->AddUser(test_account_id2_);
207 } 199 }
208 200
209 void WallpaperPrivateApiMultiUserUnittest::TearDown() { 201 void WallpaperPrivateApiMultiUserUnittest::TearDown() {
210 chrome::MultiUserWindowManager::DeleteInstance(); 202 chrome::MultiUserWindowManager::DeleteInstance();
211 AshTestBase::TearDown(); 203 AshTestBase::TearDown();
212 WallpaperManager::Shutdown(); 204 WallpaperManager::Shutdown();
213 } 205 }
214 206
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Then we destroy window 0 and call the restore function. 370 // Then we destroy window 0 and call the restore function.
379 window0.reset(); 371 window0.reset();
380 EXPECT_TRUE(RunRestoreFunction()); 372 EXPECT_TRUE(RunRestoreFunction());
381 373
382 EXPECT_FALSE(window1_state->IsMinimized()); 374 EXPECT_FALSE(window1_state->IsMinimized());
383 EXPECT_FALSE(window2_state->IsMinimized()); 375 EXPECT_FALSE(window2_state->IsMinimized());
384 EXPECT_FALSE(window3_state->IsMinimized()); 376 EXPECT_FALSE(window3_state->IsMinimized());
385 } 377 }
386 378
387 } // namespace chromeos 379 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698