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

Side by Side Diff: chrome/browser/chromeos/login/managed/managed_user_password_browsertest.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 StartUserCreation("managed-user-creation-next-button", 71 StartUserCreation("managed-user-creation-next-button",
72 kTestSupervisedUserDisplayName); 72 kTestSupervisedUserDisplayName);
73 } 73 }
74 74
75 // Supervised user signs in, get sync notification about password update, and 75 // Supervised user signs in, get sync notification about password update, and
76 // schedules password migration. 76 // schedules password migration.
77 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, 77 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest,
78 DISABLED_PRE_PasswordChangeFromUserTest) { 78 DISABLED_PRE_PasswordChangeFromUserTest) {
79 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); 79 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName);
80 80
81 const User* user = UserManager::Get()->GetUsers().at(0); 81 const User* user = GetUserManager()->GetUsers().at(0);
82 std::string sync_id = 82 std::string sync_id =
83 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( 83 GetUserManager()->GetSupervisedUserManager()->GetUserSyncId(
84 user->email()); 84 user->email());
85 base::DictionaryValue password; 85 base::DictionaryValue password;
86 password.SetIntegerWithoutPathExpansion( 86 password.SetIntegerWithoutPathExpansion(
87 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); 87 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED);
88 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); 88 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2);
89 89
90 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); 90 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature");
91 password.SetStringWithoutPathExpansion(kEncryptedPassword, 91 password.SetStringWithoutPathExpansion(kEncryptedPassword,
92 "new-encrypted-password"); 92 "new-encrypted-password");
93 93
(...skipping 22 matching lines...) Expand all
116 StartFlowLoginAsManager(); 116 StartFlowLoginAsManager();
117 FillNewUserData(kTestSupervisedUserDisplayName); 117 FillNewUserData(kTestSupervisedUserDisplayName);
118 StartUserCreation("managed-user-creation-next-button", 118 StartUserCreation("managed-user-creation-next-button",
119 kTestSupervisedUserDisplayName); 119 kTestSupervisedUserDisplayName);
120 } 120 }
121 121
122 // Manager signs in, gets sync notification about supervised user password 122 // Manager signs in, gets sync notification about supervised user password
123 // update, and performs migration. 123 // update, and performs migration.
124 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, 124 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest,
125 DISABLED_PRE_PasswordChangeFromManagerTest) { 125 DISABLED_PRE_PasswordChangeFromManagerTest) {
126 const User* managed_user = UserManager::Get()->GetUsers().at(0); 126 const User* managed_user = GetUserManager()->GetUsers().at(0);
127 127
128 SigninAsManager(1); 128 SigninAsManager(1);
129 129
130 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); 130 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1);
131 131
132 std::string sync_id = 132 std::string sync_id =
133 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( 133 GetUserManager()->GetSupervisedUserManager()->GetUserSyncId(
134 managed_user->email()); 134 managed_user->email());
135 135
136 ::sync_pb::ManagedUserSpecifics managed_user_proto; 136 ::sync_pb::ManagedUserSpecifics managed_user_proto;
137 137
138 managed_user_proto.set_id(sync_id); 138 managed_user_proto.set_id(sync_id);
139 managed_user_proto.set_name(kTestSupervisedUserDisplayName); 139 managed_user_proto.set_name(kTestSupervisedUserDisplayName);
140 managed_user_proto.set_acknowledged(true); 140 managed_user_proto.set_acknowledged(true);
141 managed_user_proto.set_master_key("master key"); 141 managed_user_proto.set_master_key("master key");
142 managed_user_proto.set_password_signature_key("signature_key"); 142 managed_user_proto.set_password_signature_key("signature_key");
143 managed_user_proto.set_password_encryption_key("encryption_key"); 143 managed_user_proto.set_password_encryption_key("encryption_key");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 StartUserCreation("managed-user-creation-next-button", 182 StartUserCreation("managed-user-creation-next-button",
183 kTestSupervisedUserDisplayName); 183 kTestSupervisedUserDisplayName);
184 } 184 }
185 185
186 // Supervised user signs in, get sync notification about password update, and 186 // Supervised user signs in, get sync notification about password update, and
187 // schedules password migration. 187 // schedules password migration.
188 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, 188 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest,
189 DISABLED_PRE_PRE_PasswordChangeUserAndManagerTest) { 189 DISABLED_PRE_PRE_PasswordChangeUserAndManagerTest) {
190 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName); 190 SigninAsSupervisedUser(true, 0, kTestSupervisedUserDisplayName);
191 191
192 const User* user = UserManager::Get()->GetUsers().at(0); 192 const User* user = GetUserManager()->GetUsers().at(0);
193 std::string sync_id = 193 std::string sync_id =
194 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( 194 GetUserManager()->GetSupervisedUserManager()->GetUserSyncId(
195 user->email()); 195 user->email());
196 base::DictionaryValue password; 196 base::DictionaryValue password;
197 password.SetIntegerWithoutPathExpansion( 197 password.SetIntegerWithoutPathExpansion(
198 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED); 198 kSchemaVersion, SupervisedUserAuthentication::SCHEMA_SALT_HASHED);
199 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2); 199 password.SetIntegerWithoutPathExpansion(kPasswordRevision, 2);
200 200
201 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature"); 201 password.SetStringWithoutPathExpansion(kPasswordSignature, "signature");
202 password.SetStringWithoutPathExpansion(kEncryptedPassword, 202 password.SetStringWithoutPathExpansion(kEncryptedPassword,
203 "new-encrypted-password"); 203 "new-encrypted-password");
204 204
205 shared_settings_adapter_->AddChange( 205 shared_settings_adapter_->AddChange(
206 sync_id, supervised_users::kChromeOSPasswordData, password, true, false); 206 sync_id, supervised_users::kChromeOSPasswordData, password, true, false);
207 content::RunAllPendingInMessageLoop(); 207 content::RunAllPendingInMessageLoop();
208 } 208 }
209 209
210 // After that manager signs in, and also detects password change. Manager 210 // After that manager signs in, and also detects password change. Manager
211 // performs the migration. 211 // performs the migration.
212 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, 212 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest,
213 DISABLED_PRE_PasswordChangeUserAndManagerTest) { 213 DISABLED_PRE_PasswordChangeUserAndManagerTest) {
214 const User* managed_user = UserManager::Get()->GetUsers().at(0); 214 const User* managed_user = GetUserManager()->GetUsers().at(0);
215 215
216 SigninAsManager(1); 216 SigninAsManager(1);
217 217
218 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1); 218 EXPECT_CALL(*mock_homedir_methods_, AddKeyEx(_, _, _, _, _)).Times(1);
219 219
220 std::string sync_id = 220 std::string sync_id =
221 UserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( 221 GetUserManager()->GetSupervisedUserManager()->GetUserSyncId(
222 managed_user->email()); 222 managed_user->email());
223 223
224 ::sync_pb::ManagedUserSpecifics managed_user_proto; 224 ::sync_pb::ManagedUserSpecifics managed_user_proto;
225 225
226 managed_user_proto.set_id(sync_id); 226 managed_user_proto.set_id(sync_id);
227 managed_user_proto.set_name(kTestSupervisedUserDisplayName); 227 managed_user_proto.set_name(kTestSupervisedUserDisplayName);
228 managed_user_proto.set_acknowledged(true); 228 managed_user_proto.set_acknowledged(true);
229 managed_user_proto.set_master_key("master key"); 229 managed_user_proto.set_master_key("master key");
230 managed_user_proto.set_password_signature_key("signature_key"); 230 managed_user_proto.set_password_signature_key("signature_key");
231 managed_user_proto.set_password_encryption_key("encryption_key"); 231 managed_user_proto.set_password_encryption_key("encryption_key");
(...skipping 20 matching lines...) Expand all
252 // should be attempted. 252 // should be attempted.
253 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest, 253 IN_PROC_BROWSER_TEST_F(SupervisedUserPasswordTest,
254 DISABLED_PasswordChangeUserAndManagerTest) { 254 DISABLED_PasswordChangeUserAndManagerTest) {
255 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1); 255 EXPECT_CALL(*mock_homedir_methods_, MountEx(_, _, _, _)).Times(1);
256 EXPECT_CALL(*mock_homedir_methods_, UpdateKeyEx(_, _, _, _, _)).Times(0); 256 EXPECT_CALL(*mock_homedir_methods_, UpdateKeyEx(_, _, _, _, _)).Times(0);
257 SigninAsSupervisedUser(false, 1, kTestSupervisedUserDisplayName); 257 SigninAsSupervisedUser(false, 1, kTestSupervisedUserDisplayName);
258 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); 258 testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_);
259 } 259 }
260 260
261 } // namespace chromeos 261 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698