| 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" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 user_manager::UserManager* user_manager = user_manager::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(AccountId::FromUserEmail(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(AccountId::FromUserEmail(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 |