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/ui/cocoa/profiles/user_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/profiles/profile_window.h" | 8 #include "chrome/browser/profiles/profile_window.h" |
9 #include "chrome/browser/ui/user_manager.h" | 9 #include "chrome/browser/ui/user_manager.h" |
10 #include "chrome/test/base/browser_with_test_window_test.h" | 10 #include "chrome/test/base/browser_with_test_window_test.h" |
11 #include "chrome/test/base/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
12 #include "chrome/test/base/testing_profile_manager.h" | 12 #include "chrome/test/base/testing_profile_manager.h" |
13 | 13 |
14 class UserManagerMacTest : public BrowserWithTestWindowTest { | 14 class UserManagerMacTest : public BrowserWithTestWindowTest { |
15 public: | 15 public: |
16 UserManagerMacTest() | 16 UserManagerMacTest() |
17 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) { | 17 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) { |
18 } | 18 } |
19 | 19 |
20 void SetUp() override { | 20 void SetUp() override { |
21 BrowserWithTestWindowTest::SetUp(); | 21 BrowserWithTestWindowTest::SetUp(); |
22 ASSERT_TRUE(testing_profile_manager_.SetUp()); | 22 ASSERT_TRUE(testing_profile_manager_.SetUp()); |
23 // Pre-load the guest profile so we don't have to wait for the User Manager | 23 // Pre-load the system profile so we don't have to wait for the User Manager |
24 // to asynchronously create it. | 24 // to asynchronously create it. |
25 testing_profile_manager_.CreateGuestProfile(); | 25 testing_profile_manager_.CreateSystemProfile(); |
26 } | 26 } |
27 | 27 |
28 void TearDown() override { | 28 void TearDown() override { |
29 testing_profile_manager_.DeleteGuestProfile(); | 29 testing_profile_manager_.DeleteSystemProfile(); |
30 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 30 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
31 base::RunLoop().RunUntilIdle(); | 31 base::RunLoop().RunUntilIdle(); |
32 BrowserWithTestWindowTest::TearDown(); | 32 BrowserWithTestWindowTest::TearDown(); |
33 } | 33 } |
34 | 34 |
35 private: | 35 private: |
36 TestingProfileManager testing_profile_manager_; | 36 TestingProfileManager testing_profile_manager_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(UserManagerMacTest); | 38 DISALLOW_COPY_AND_ASSIGN(UserManagerMacTest); |
39 }; | 39 }; |
40 | 40 |
41 TEST_F(UserManagerMacTest, ShowUserManager) { | 41 TEST_F(UserManagerMacTest, ShowUserManager) { |
42 EXPECT_FALSE(UserManager::IsShowing()); | 42 EXPECT_FALSE(UserManager::IsShowing()); |
43 UserManager::Show(base::FilePath(), | 43 UserManager::Show(base::FilePath(), |
44 profiles::USER_MANAGER_NO_TUTORIAL, | 44 profiles::USER_MANAGER_NO_TUTORIAL, |
45 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 45 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
46 EXPECT_TRUE(UserManager::IsShowing()); | 46 EXPECT_TRUE(UserManager::IsShowing()); |
47 | 47 |
48 UserManager::Hide(); | 48 UserManager::Hide(); |
49 EXPECT_FALSE(UserManager::IsShowing()); | 49 EXPECT_FALSE(UserManager::IsShowing()); |
50 } | 50 } |
OLD | NEW |