OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/net/nss_context.h" | 5 #include "chrome/browser/net/nss_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
12 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "components/user_manager/user.h" | 13 #include "components/user_manager/user.h" |
| 14 #include "components/user_manager/user_manager.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "net/cert/nss_cert_database.h" | 16 #include "net/cert/nss_cert_database.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const char kTestUser1[] = "test-user1@gmail.com"; | 20 const char kTestUser1[] = "test-user1@gmail.com"; |
21 const char kTestUser2[] = "test-user2@gmail.com"; | 21 const char kTestUser2[] = "test-user2@gmail.com"; |
22 | 22 |
23 void NotCalledDbCallback(net::NSSCertDatabase* db) { ASSERT_TRUE(false); } | 23 void NotCalledDbCallback(net::NSSCertDatabase* db) { ASSERT_TRUE(false); } |
24 | 24 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 }; | 124 }; |
125 | 125 |
126 IN_PROC_BROWSER_TEST_F(NSSContextChromeOSBrowserTest, PRE_TwoUsers) { | 126 IN_PROC_BROWSER_TEST_F(NSSContextChromeOSBrowserTest, PRE_TwoUsers) { |
127 // Initialization for ChromeOS multi-profile test infrastructure. | 127 // Initialization for ChromeOS multi-profile test infrastructure. |
128 RegisterUser(kTestUser1); | 128 RegisterUser(kTestUser1); |
129 RegisterUser(kTestUser2); | 129 RegisterUser(kTestUser2); |
130 chromeos::StartupUtils::MarkOobeCompleted(); | 130 chromeos::StartupUtils::MarkOobeCompleted(); |
131 } | 131 } |
132 | 132 |
133 IN_PROC_BROWSER_TEST_F(NSSContextChromeOSBrowserTest, TwoUsers) { | 133 IN_PROC_BROWSER_TEST_F(NSSContextChromeOSBrowserTest, TwoUsers) { |
134 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 134 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
135 | 135 |
136 // Log in first user and get their DB. | 136 // Log in first user and get their DB. |
137 LoginUser(kTestUser1); | 137 LoginUser(kTestUser1); |
138 Profile* profile1 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( | 138 Profile* profile1 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( |
139 user_manager->FindUser(kTestUser1)); | 139 user_manager->FindUser(kTestUser1)); |
140 ASSERT_TRUE(profile1); | 140 ASSERT_TRUE(profile1); |
141 | 141 |
142 DBTester tester1(profile1); | 142 DBTester tester1(profile1); |
143 ASSERT_TRUE(tester1.DoGetDBTests()); | 143 ASSERT_TRUE(tester1.DoGetDBTests()); |
144 | 144 |
145 // Log in second user and get their DB. | 145 // Log in second user and get their DB. |
146 chromeos::UserAddingScreen::Get()->Start(); | 146 chromeos::UserAddingScreen::Get()->Start(); |
147 base::RunLoop().RunUntilIdle(); | 147 base::RunLoop().RunUntilIdle(); |
148 AddUser(kTestUser2); | 148 AddUser(kTestUser2); |
149 | 149 |
150 Profile* profile2 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( | 150 Profile* profile2 = chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe( |
151 user_manager->FindUser(kTestUser2)); | 151 user_manager->FindUser(kTestUser2)); |
152 ASSERT_TRUE(profile2); | 152 ASSERT_TRUE(profile2); |
153 | 153 |
154 DBTester tester2(profile2); | 154 DBTester tester2(profile2); |
155 ASSERT_TRUE(tester2.DoGetDBTests()); | 155 ASSERT_TRUE(tester2.DoGetDBTests()); |
156 | 156 |
157 // Get both DBs again to check that the same object is returned. | 157 // Get both DBs again to check that the same object is returned. |
158 tester1.DoGetDBAgainTests(); | 158 tester1.DoGetDBAgainTests(); |
159 tester2.DoGetDBAgainTests(); | 159 tester2.DoGetDBAgainTests(); |
160 | 160 |
161 // Check that each user has a separate DB and NSS slots. | 161 // Check that each user has a separate DB and NSS slots. |
162 tester1.DoNotEqualsTests(&tester2); | 162 tester1.DoNotEqualsTests(&tester2); |
163 } | 163 } |
OLD | NEW |