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

Side by Side Diff: chrome/browser/ui/browser_finder_chromeos_unittest.cc

Issue 2661283002: cros: Clean up SessionStateDelegate refs in Chrome (Closed)
Patch Set: update browser_finder_chromeos_unittest 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/ui/browser_finder.h" 5 #include "chrome/browser/ui/browser_finder.h"
6 6
7 #include "ash/common/test/test_session_state_delegate.h"
8 #include "ash/shell.h"
9 #include "ash/test/ash_test_helper.h"
10 #include "base/macros.h" 7 #include "base/macros.h"
11 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 8 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 9 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
13 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 10 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" 11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 12 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 13 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
17 #include "chrome/test/base/browser_with_test_window_test.h" 14 #include "chrome/test/base/browser_with_test_window_test.h"
18 #include "chrome/test/base/test_browser_window_aura.h" 15 #include "chrome/test/base/test_browser_window_aura.h"
19 #include "chrome/test/base/testing_browser_process.h" 16 #include "chrome/test/base/testing_browser_process.h"
(...skipping 18 matching lines...) Expand all
38 user_manager_enabler_(fake_user_manager_) {} 35 user_manager_enabler_(fake_user_manager_) {}
39 36
40 TestingProfile* CreateMultiUserProfile(const AccountId& account_id) { 37 TestingProfile* CreateMultiUserProfile(const AccountId& account_id) {
41 TestingProfile* profile = 38 TestingProfile* profile =
42 profile_manager_->CreateTestingProfile(account_id.GetUserEmail()); 39 profile_manager_->CreateTestingProfile(account_id.GetUserEmail());
43 const user_manager::User* user = fake_user_manager_->AddUser(account_id); 40 const user_manager::User* user = fake_user_manager_->AddUser(account_id);
44 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( 41 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(
45 const_cast<user_manager::User*>(user), profile); 42 const_cast<user_manager::User*>(user), profile);
46 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting( 43 chromeos::ProfileHelper::Get()->SetProfileToUserMappingForTesting(
47 const_cast<user_manager::User*>(user)); 44 const_cast<user_manager::User*>(user));
48 ash::test::AshTestHelper::GetTestSessionStateDelegate()->AddUser(
49 account_id);
50 GetUserWindowManager()->AddUser(profile); 45 GetUserWindowManager()->AddUser(profile);
51 return profile; 46 return profile;
52 } 47 }
53 48
54 chrome::MultiUserWindowManagerChromeOS* GetUserWindowManager() { 49 chrome::MultiUserWindowManagerChromeOS* GetUserWindowManager() {
55 if (!multi_user_window_manager_) { 50 if (!multi_user_window_manager_) {
56 multi_user_window_manager_ = 51 multi_user_window_manager_ =
57 new chrome::MultiUserWindowManagerChromeOS(test_account_id1_); 52 new chrome::MultiUserWindowManagerChromeOS(test_account_id1_);
58 multi_user_window_manager_->Init(); 53 multi_user_window_manager_->Init();
59 chrome::MultiUserWindowManager::SetInstanceForTest( 54 chrome::MultiUserWindowManager::SetInstanceForTest(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Move the browser window to another user's desktop. Then no window should 136 // Move the browser window to another user's desktop. Then no window should
142 // be available for the current profile. 137 // be available for the current profile.
143 GetUserWindowManager()->ShowWindowForUser( 138 GetUserWindowManager()->ShowWindowForUser(
144 browser->window()->GetNativeWindow(), test_account_id2_); 139 browser->window()->GetNativeWindow(), test_account_id2_);
145 EXPECT_EQ(0u, chrome::GetBrowserCount(profile())); 140 EXPECT_EQ(0u, chrome::GetBrowserCount(profile()));
146 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), true)); 141 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), true));
147 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false)); 142 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false));
148 } 143 }
149 144
150 } // namespace test 145 } // namespace test
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/session_controller_client.cc ('k') | chrome/browser/ui/views/frame/browser_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698