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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/chromeos/login/login_manager_test.h" | 12 #include "chrome/browser/chromeos/login/login_manager_test.h" |
13 #include "chrome/browser/chromeos/login/startup_utils.h" | 13 #include "chrome/browser/chromeos/login/startup_utils.h" |
14 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 14 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
15 #include "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" | 15 #include "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" |
16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 18 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
18 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
19 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 20 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
20 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 21 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
21 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 22 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
22 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" | 23 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" |
23 #include "chrome/browser/supervised_user/supervised_user_registration_utility_st
ub.h" | 24 #include "chrome/browser/supervised_user/supervised_user_registration_utility_st
ub.h" |
24 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" | 25 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" |
25 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" | 26 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" |
26 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" | 27 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" |
27 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" | 28 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 StartUserCreation("supervised-user-creation-next-button", | 72 StartUserCreation("supervised-user-creation-next-button", |
72 kTestSupervisedUserDisplayName); | 73 kTestSupervisedUserDisplayName); |
73 } | 74 } |
74 | 75 |
75 // Supervised user signs in, get sync notification about password update, and | 76 // Supervised user signs in, get sync notification about password update, and |
76 // schedules password migration. | 77 // schedules password migration. |
77 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, | 78 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, |
78 DISABLED_PRE_PasswordChangeFromUserTest) { | 79 DISABLED_PRE_PasswordChangeFromUserTest) { |
79 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); | 80 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); |
80 | 81 |
81 const user_manager::User* user = UserManager::Get()->GetUsers().at(0); | 82 const user_manager::User* user = |
| 83 user_manager::UserManager::Get()->GetUsers().at(0); |
82 std::string sync_id = | 84 std::string sync_id = |
83 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( | 85 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( |
84 user->email()); | 86 user->email()); |
85 base::DictionaryValue password; | 87 base::DictionaryValue password; |
86 password.SetIntegerWithoutPathExpansion( | 88 password.SetIntegerWithoutPathExpansion( |
87 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); | 89 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); |
88 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); | 90 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); |
89 | 91 |
90 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); | 92 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); |
91 password.SetStringWithoutPathExpansion(kEncryptedPassword, | 93 password.SetStringWithoutPathExpansion(kEncryptedPassword, |
92 "new-encrypted-password"); | 94 "new-encrypted-password"); |
93 | 95 |
(...skipping 23 matching lines...) Expand all Loading... |
117 FillNewUserData(kTestSupervisedUserDisplayName); | 119 FillNewUserData(kTestSupervisedUserDisplayName); |
118 StartUserCreation("supervised-user-creation-next-button", | 120 StartUserCreation("supervised-user-creation-next-button", |
119 kTestSupervisedUserDisplayName); | 121 kTestSupervisedUserDisplayName); |
120 } | 122 } |
121 | 123 |
122 // Manager signs in, gets sync notification about supervised user password | 124 // Manager signs in, gets sync notification about supervised user password |
123 // update, and performs migration. | 125 // update, and performs migration. |
124 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, | 126 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, |
125 DISABLED_PRE_PasswordChangeFromManagerTest) { | 127 DISABLED_PRE_PasswordChangeFromManagerTest) { |
126 const user_manager::User* supervised_user = | 128 const user_manager::User* supervised_user = |
127 UserManager::Get()->GetUsers().at(0); | 129 user_manager::UserManager::Get()->GetUsers().at(0); |
128 | 130 |
129 SigninAsManager(1); | 131 SigninAsManager(1); |
130 | 132 |
131 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); | 133 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); |
132 | 134 |
133 std::string sync_id = | 135 std::string sync_id = |
134 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( | 136 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( |
135 supervised_user->email()); | 137 supervised_user->email()); |
136 | 138 |
137 ::sync_pb::ManagedUserSpecifics managed_user_proto; | 139 ::sync_pb::ManagedUserSpecifics managed_user_proto; |
138 | 140 |
139 managed_user_proto.set_id(sync_id); | 141 managed_user_proto.set_id(sync_id); |
140 managed_user_proto.set_name(kTestSupervisedUserDisplayName); | 142 managed_user_proto.set_name(kTestSupervisedUserDisplayName); |
141 managed_user_proto.set_acknowledged(true); | 143 managed_user_proto.set_acknowledged(true); |
142 managed_user_proto.set_master_key("master key"); | 144 managed_user_proto.set_master_key("master key"); |
143 managed_user_proto.set_password_signature_key("signature_key"); | 145 managed_user_proto.set_password_signature_key("signature_key"); |
144 managed_user_proto.set_password_encryption_key("encryption_key"); | 146 managed_user_proto.set_password_encryption_key("encryption_key"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 StartUserCreation("supervised-user-creation-next-button", | 185 StartUserCreation("supervised-user-creation-next-button", |
184 kTestSupervisedUserDisplayName); | 186 kTestSupervisedUserDisplayName); |
185 } | 187 } |
186 | 188 |
187 // Supervised user signs in, get sync notification about password update, and | 189 // Supervised user signs in, get sync notification about password update, and |
188 // schedules password migration. | 190 // schedules password migration. |
189 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, | 191 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, |
190 DISABLED_PRE_PRE_PasswordChangeUserAndManagerTest) { | 192 DISABLED_PRE_PRE_PasswordChangeUserAndManagerTest) { |
191 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); | 193 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); |
192 | 194 |
193 const user_manager::User* user = UserManager::Get()->GetUsers().at(0); | 195 const user_manager::User* user = |
| 196 user_manager::UserManager::Get()->GetUsers().at(0); |
194 std::string sync_id = | 197 std::string sync_id = |
195 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( | 198 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( |
196 user->email()); | 199 user->email()); |
197 base::DictionaryValue password; | 200 base::DictionaryValue password; |
198 password.SetIntegerWithoutPathExpansion( | 201 password.SetIntegerWithoutPathExpansion( |
199 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); | 202 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); |
200 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); | 203 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); |
201 | 204 |
202 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); | 205 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); |
203 password.SetStringWithoutPathExpansion(kEncryptedPassword, | 206 password.SetStringWithoutPathExpansion(kEncryptedPassword, |
204 "new-encrypted-password"); | 207 "new-encrypted-password"); |
205 | 208 |
206 shared_settings_adapter_->AddChange( | 209 shared_settings_adapter_->AddChange( |
207 sync_id, supervised_users::kChromeOSPasswordData, password, true, false); | 210 sync_id, supervised_users::kChromeOSPasswordData, password, true, false); |
208 content::RunAllPendingInMessageLoop(); | 211 content::RunAllPendingInMessageLoop(); |
209 } | 212 } |
210 | 213 |
211 // After that manager signs in, and also detects password change. Manager | 214 // After that manager signs in, and also detects password change. Manager |
212 // performs the migration. | 215 // performs the migration. |
213 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, | 216 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, |
214 DISABLED_PRE_PasswordChangeUserAndManagerTest) { | 217 DISABLED_PRE_PasswordChangeUserAndManagerTest) { |
215 const user_manager::User* supervised_user = | 218 const user_manager::User* supervised_user = |
216 UserManager::Get()->GetUsers().at(0); | 219 user_manager::UserManager::Get()->GetUsers().at(0); |
217 | 220 |
218 SigninAsManager(1); | 221 SigninAsManager(1); |
219 | 222 |
220 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); | 223 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); |
221 | 224 |
222 std::string sync_id = | 225 std::string sync_id = |
223 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( | 226 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( |
224 supervised_user->email()); | 227 supervised_user->email()); |
225 | 228 |
226 ::sync_pb::ManagedUserSpecifics managed_user_proto; | 229 ::sync_pb::ManagedUserSpecifics managed_user_proto; |
227 | 230 |
228 managed_user_proto.set_id(sync_id); | 231 managed_user_proto.set_id(sync_id); |
229 managed_user_proto.set_name(kTestSupervisedUserDisplayName); | 232 managed_user_proto.set_name(kTestSupervisedUserDisplayName); |
230 managed_user_proto.set_acknowledged(true); | 233 managed_user_proto.set_acknowledged(true); |
231 managed_user_proto.set_master_key("master key"); | 234 managed_user_proto.set_master_key("master key"); |
232 managed_user_proto.set_password_signature_key("signature_key"); | 235 managed_user_proto.set_password_signature_key("signature_key"); |
233 managed_user_proto.set_password_encryption_key("encryption_key"); | 236 managed_user_proto.set_password_encryption_key("encryption_key"); |
(...skipping 20 matching lines...) Expand all Loading... |
254 // should be attempted. | 257 // should be attempted. |
255 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, | 258 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, |
256 DISABLED_PasswordChangeUserAndManagerTest) { | 259 DISABLED_PasswordChangeUserAndManagerTest) { |
257 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1); | 260 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1); |
258 EXPECT_CALL(*mock_homedir_methods_, UpdateKeyEx(_, _, _, _, _)).Times(0); | 261 EXPECT_CALL(*mock_homedir_methods_, UpdateKeyEx(_, _, _, _, _)).Times(0); |
259 SigninAsSupervisedUser(false, 1, kTestSupervisedUserDisplayName); | 262 SigninAsSupervisedUser(false, 1, kTestSupervisedUserDisplayName); |
260 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); | 263 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); |
261 } | 264 } |
262 | 265 |
263 } // namespace chromeos | 266 } // namespace chromeos |
OLD | NEW |