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/chromeos/login/auth/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/parallel_authenticator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
32 #include "chromeos/cryptohome/mock_async_method_caller.h" | 32 #include "chromeos/cryptohome/mock_async_method_caller.h" |
33 #include "chromeos/cryptohome/system_salt_getter.h" | 33 #include "chromeos/cryptohome/system_salt_getter.h" |
34 #include "chromeos/dbus/fake_cryptohome_client.h" | 34 #include "chromeos/dbus/fake_cryptohome_client.h" |
35 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 35 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
36 #include "chromeos/login/auth/key.h" | 36 #include "chromeos/login/auth/key.h" |
37 #include "chromeos/login/auth/mock_auth_status_consumer.h" | 37 #include "chromeos/login/auth/mock_auth_status_consumer.h" |
38 #include "chromeos/login/auth/user_context.h" | 38 #include "chromeos/login/auth/user_context.h" |
39 #include "content/public/test/test_browser_thread_bundle.h" | 39 #include "content/public/test/test_browser_thread_bundle.h" |
40 #include "crypto/nss_util.h" | 40 #include "crypto/nss_util.h" |
| 41 #include "crypto/nss_util_internal.h" |
41 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 42 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
42 #include "net/base/net_errors.h" | 43 #include "net/base/net_errors.h" |
43 #include "net/url_request/url_request_status.h" | 44 #include "net/url_request/url_request_status.h" |
44 #include "testing/gmock/include/gmock/gmock.h" | 45 #include "testing/gmock/include/gmock/gmock.h" |
45 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
46 #include "third_party/cros_system_api/dbus/service_constants.h" | 47 #include "third_party/cros_system_api/dbus/service_constants.h" |
47 #include "url/gurl.h" | 48 #include "url/gurl.h" |
48 | 49 |
49 using ::testing::Invoke; | 50 using ::testing::Invoke; |
50 using ::testing::Return; | 51 using ::testing::Return; |
51 using ::testing::_; | 52 using ::testing::_; |
52 | 53 |
53 namespace chromeos { | 54 namespace chromeos { |
54 | 55 |
| 56 namespace { |
| 57 |
| 58 // An owner key in PKCS#8 PrivateKeyInfo for testing owner checks. |
| 59 const uint8 kOwnerPrivateKey[] = { |
| 60 0x30, 0x82, 0x01, 0x53, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, |
| 61 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, |
| 62 0x01, 0x3d, 0x30, 0x82, 0x01, 0x39, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, |
| 63 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, 0xdf, |
| 64 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, 0xf3, |
| 65 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, 0xbb, |
| 66 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, 0x15, |
| 67 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, 0x3d, |
| 68 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x40, 0x40, |
| 69 0xc7, 0xb5, 0xb3, 0xbc, 0xac, 0x0a, 0x77, 0x02, 0x0f, 0x05, 0xda, 0xdb, |
| 70 0xfc, 0x48, 0xf6, 0x0a, 0xb5, 0xf2, 0xef, 0x31, 0x1c, 0x36, 0xb1, 0x0f, |
| 71 0xa7, 0x5a, 0xf3, 0xb9, 0xa3, 0x4e, 0xb8, 0xf6, 0x10, 0xfe, 0x25, 0x7b, |
| 72 0x36, 0xb4, 0x1b, 0x80, 0xe3, 0x92, 0x37, 0x83, 0xf0, 0x43, 0xb3, 0x00, |
| 73 0xa6, 0x53, 0xc6, 0x1b, 0x7e, 0x4b, 0xb0, 0x33, 0xd4, 0xe1, 0x03, 0xc4, |
| 74 0xaa, 0xbc, 0x89, 0x02, 0x21, 0x00, 0xde, 0xc8, 0x8d, 0x10, 0xbc, 0xf3, |
| 75 0x43, 0x49, 0x1f, 0x07, 0xf7, 0x12, 0xeb, 0x0a, 0x90, 0xab, 0xb9, 0xaa, |
| 76 0x81, 0xb5, 0x54, 0x71, 0xf4, 0x2e, 0xc4, 0x44, 0xec, 0xff, 0x7d, 0xff, |
| 77 0xe8, 0xa5, 0x02, 0x21, 0x00, 0xcf, 0xf0, 0xbe, 0xa6, 0xde, 0x9c, 0x70, |
| 78 0xed, 0xf0, 0xc3, 0x18, 0x9b, 0xca, 0xe5, 0x7c, 0x4b, 0x9b, 0xf5, 0x12, |
| 79 0x5d, 0x86, 0xbe, 0x8d, 0xf1, 0xbc, 0x2c, 0x79, 0x59, 0xf5, 0xff, 0xbc, |
| 80 0x6b, 0x02, 0x20, 0x7c, 0x09, 0x1c, 0xc1, 0x1c, 0xf2, 0x33, 0x9c, 0x1a, |
| 81 0x72, 0xcc, 0xd4, 0xf3, 0x97, 0xc6, 0x44, 0x55, 0xf2, 0xe0, 0x94, 0x9c, |
| 82 0x97, 0x75, 0x64, 0x34, 0x52, 0x4b, 0xc1, 0x53, 0xdd, 0x8f, 0x21, 0x02, |
| 83 0x20, 0x0e, 0xef, 0x48, 0x92, 0x2d, 0x9c, 0xe8, 0xd3, 0x7e, 0x1e, 0x55, |
| 84 0x0f, 0x23, 0x74, 0x76, 0x07, 0xec, 0x2c, 0x9e, 0xe4, 0x0e, 0xc0, 0x72, |
| 85 0xeb, 0x70, 0xcb, 0x74, 0xef, 0xcc, 0x26, 0x50, 0xff, 0x02, 0x20, 0x29, |
| 86 0x32, 0xd0, 0xbf, 0x11, 0xf2, 0xbf, 0x54, 0xfd, 0x6d, 0xf2, 0x1c, 0xbe, |
| 87 0x50, 0x18, 0x62, 0x6d, 0x23, 0xe4, 0x26, 0x03, 0x8b, 0xb3, 0x42, 0x24, |
| 88 0x7e, 0x68, 0x37, 0x26, 0xda, 0xb9, 0x87 |
| 89 }; |
| 90 |
| 91 // The public key alone matcing kOwnerPrivateKey. |
| 92 const uint8 kOwnerPublicKey[] = { |
| 93 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, |
| 94 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, |
| 95 0x00, 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, |
| 96 0xdf, 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, |
| 97 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, |
| 98 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, |
| 99 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, |
| 100 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01 |
| 101 }; |
| 102 |
| 103 std::vector<uint8> GetOwnerPublicKey() { |
| 104 return std::vector<uint8>(kOwnerPublicKey, |
| 105 kOwnerPublicKey + arraysize(kOwnerPublicKey)); |
| 106 } |
| 107 |
| 108 scoped_ptr<crypto::RSAPrivateKey> CreateOwnerKeyInSlot(PK11SlotInfo* slot) { |
| 109 const std::vector<uint8> key(kOwnerPrivateKey, |
| 110 kOwnerPrivateKey + arraysize(kOwnerPrivateKey)); |
| 111 return make_scoped_ptr( |
| 112 crypto::RSAPrivateKey::CreateSensitiveFromPrivateKeyInfo(slot, key)); |
| 113 } |
| 114 |
| 115 } // namespace |
| 116 |
55 class ParallelAuthenticatorTest : public testing::Test { | 117 class ParallelAuthenticatorTest : public testing::Test { |
56 public: | 118 public: |
57 ParallelAuthenticatorTest() | 119 ParallelAuthenticatorTest() |
58 : user_context_("me@nowhere.org"), | 120 : user_context_("me@nowhere.org"), |
59 user_manager_(new FakeUserManager()), | 121 user_manager_(new FakeUserManager()), |
60 user_manager_enabler_(user_manager_), | 122 user_manager_enabler_(user_manager_), |
61 mock_caller_(NULL), | 123 mock_caller_(NULL), |
62 owner_key_util_(new MockOwnerKeyUtil) { | 124 owner_key_util_(new MockOwnerKeyUtil) { |
63 user_context_.SetKey(Key("fakepass")); | 125 user_context_.SetKey(Key("fakepass")); |
64 user_context_.SetUserIDHash("me_nowhere_com_hash"); | 126 user_context_.SetUserIDHash("me_nowhere_com_hash"); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 ScopedTestCrosSettings test_cros_settings_; | 262 ScopedTestCrosSettings test_cros_settings_; |
201 | 263 |
202 TestingProfile profile_; | 264 TestingProfile profile_; |
203 scoped_ptr<TestingProfileManager> profile_manager_; | 265 scoped_ptr<TestingProfileManager> profile_manager_; |
204 FakeUserManager* user_manager_; | 266 FakeUserManager* user_manager_; |
205 ScopedUserManagerEnabler user_manager_enabler_; | 267 ScopedUserManagerEnabler user_manager_enabler_; |
206 | 268 |
207 cryptohome::MockAsyncMethodCaller* mock_caller_; | 269 cryptohome::MockAsyncMethodCaller* mock_caller_; |
208 | 270 |
209 MockAuthStatusConsumer consumer_; | 271 MockAuthStatusConsumer consumer_; |
210 crypto::ScopedTestNSSDB test_nssdb_; | |
211 | 272 |
212 scoped_refptr<ParallelAuthenticator> auth_; | 273 scoped_refptr<ParallelAuthenticator> auth_; |
213 scoped_ptr<TestAttemptState> state_; | 274 scoped_ptr<TestAttemptState> state_; |
214 FakeCryptohomeClient* fake_cryptohome_client_; | 275 FakeCryptohomeClient* fake_cryptohome_client_; |
215 | 276 |
216 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; | 277 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; |
217 }; | 278 }; |
218 | 279 |
219 TEST_F(ParallelAuthenticatorTest, OnAuthSuccess) { | 280 TEST_F(ParallelAuthenticatorTest, OnAuthSuccess) { |
220 EXPECT_CALL(consumer_, OnAuthSuccess(user_context_)) | 281 EXPECT_CALL(consumer_, OnAuthSuccess(user_context_)) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 SetAndResolveState(auth_.get(), state_.release())); | 334 SetAndResolveState(auth_.get(), state_.release())); |
274 } | 335 } |
275 | 336 |
276 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededMount) { | 337 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededMount) { |
277 // Set up state as though a cryptohome mount attempt has occurred | 338 // Set up state as though a cryptohome mount attempt has occurred |
278 // and succeeded but we are in safe mode and the current user is not owner. | 339 // and succeeded but we are in safe mode and the current user is not owner. |
279 // This test will check that the "safe-mode" policy is not set and will let | 340 // This test will check that the "safe-mode" policy is not set and will let |
280 // the mount finish successfully. | 341 // the mount finish successfully. |
281 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | 342 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
282 SetOwnerState(false, false); | 343 SetOwnerState(false, false); |
283 // Test that the mount has succeeded. | |
284 state_.reset(new TestAttemptState(user_context_, false)); | |
285 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | |
286 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, | 344 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, |
287 SetAndResolveState(auth_.get(), state_.release())); | 345 SetAndResolveState(auth_.get(), state_.release())); |
288 } | 346 } |
289 | 347 |
| 348 // Test the case that login switches to SafeMode and a User that is not the |
| 349 // owner tries to log in. The login should fail because of the missing owner |
| 350 // private key. |
290 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { | 351 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { |
| 352 crypto::ScopedTestNSSChromeOSUser user_slot(user_context_.GetUserIDHash()); |
| 353 owner_key_util_->SetPublicKey(GetOwnerPublicKey()); |
| 354 |
291 profile_manager_.reset( | 355 profile_manager_.reset( |
292 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 356 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
293 ASSERT_TRUE(profile_manager_->SetUp()); | 357 ASSERT_TRUE(profile_manager_->SetUp()); |
294 | 358 |
295 FailOnLoginSuccess(); // Set failing on success as the default... | 359 FailOnLoginSuccess(); // Set failing on success as the default... |
296 AuthFailure failure = AuthFailure(AuthFailure::OWNER_REQUIRED); | 360 AuthFailure failure = AuthFailure(AuthFailure::OWNER_REQUIRED); |
297 ExpectLoginFailure(failure); | 361 ExpectLoginFailure(failure); |
298 | 362 |
299 fake_cryptohome_client_->set_unmount_result(true); | |
300 | |
301 CrosSettingsProvider* device_settings_provider; | |
302 StubCrosSettingsProvider stub_settings_provider; | |
303 // Set up state as though a cryptohome mount attempt has occurred | 363 // Set up state as though a cryptohome mount attempt has occurred |
304 // and succeeded but we are in safe mode and the current user is not owner. | 364 // and succeeded but we are in safe mode and the current user is not owner. |
305 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | 365 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
306 SetOwnerState(false, false); | 366 SetOwnerState(false, false); |
307 // Remove the real DeviceSettingsProvider and replace it with a stub. | 367 // Remove the real DeviceSettingsProvider and replace it with a stub. |
308 device_settings_provider = | 368 CrosSettingsProvider* device_settings_provider = |
309 CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); | 369 CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); |
310 EXPECT_TRUE(device_settings_provider != NULL); | 370 EXPECT_TRUE(device_settings_provider != NULL); |
311 EXPECT_TRUE( | 371 EXPECT_TRUE( |
312 CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); | 372 CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); |
| 373 StubCrosSettingsProvider stub_settings_provider; |
313 CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); | 374 CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); |
314 CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); | 375 CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); |
315 | 376 |
316 // Initialize login state for this test to verify the login state is changed | 377 // Initialize login state for this test to verify the login state is changed |
317 // to SAFE_MODE. | 378 // to SAFE_MODE. |
318 LoginState::Initialize(); | 379 LoginState::Initialize(); |
319 | 380 |
320 EXPECT_EQ(ParallelAuthenticator::CONTINUE, | 381 EXPECT_EQ(ParallelAuthenticator::CONTINUE, |
321 SetAndResolveState(auth_.get(), state_.release())); | 382 SetAndResolveState(auth_.get(), state_.release())); |
322 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); | 383 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); |
323 | 384 |
324 // Flush all the pending operations. The operations should induce an owner | 385 // Flush all the pending operations. The operations should induce an owner |
325 // verification. | 386 // verification. |
326 device_settings_test_helper_.Flush(); | 387 device_settings_test_helper_.Flush(); |
327 | 388 |
328 state_.reset(new TestAttemptState(user_context_, false)); | 389 state_.reset(new TestAttemptState(user_context_, false)); |
329 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | 390 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
330 | 391 |
331 // The owner key util should not have found the owner key, so login should | 392 // The owner key util should not have found the owner key, so login should |
332 // not be allowed. | 393 // not be allowed. |
333 EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED, | 394 EXPECT_EQ(ParallelAuthenticator::OWNER_REQUIRED, |
334 SetAndResolveState(auth_.get(), state_.release())); | 395 SetAndResolveState(auth_.get(), state_.release())); |
335 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); | 396 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); |
336 | 397 |
337 // Unset global objects used by this test. | 398 // Unset global objects used by this test. |
| 399 fake_cryptohome_client_->set_unmount_result(true); |
338 LoginState::Shutdown(); | 400 LoginState::Shutdown(); |
339 EXPECT_TRUE( | 401 EXPECT_TRUE( |
340 CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); | 402 CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); |
| 403 CrosSettings::Get()->AddSettingsProvider(device_settings_provider); |
| 404 } |
| 405 |
| 406 // Test the case that login switches to SafeMode and the Owner logs in, which |
| 407 // should lead to a successful login. |
| 408 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededSuccess) { |
| 409 crypto::ScopedTestNSSChromeOSUser test_user_db(user_context_.GetUserIDHash()); |
| 410 owner_key_util_->SetPublicKey(GetOwnerPublicKey()); |
| 411 |
| 412 crypto::ScopedPK11Slot user_slot( |
| 413 crypto::GetPublicSlotForChromeOSUser(user_context_.GetUserIDHash())); |
| 414 CreateOwnerKeyInSlot(user_slot.get()); |
| 415 |
| 416 profile_manager_.reset( |
| 417 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 418 ASSERT_TRUE(profile_manager_->SetUp()); |
| 419 |
| 420 ExpectLoginSuccess(user_context_); |
| 421 |
| 422 // Set up state as though a cryptohome mount attempt has occurred |
| 423 // and succeeded but we are in safe mode and the current user is not owner. |
| 424 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| 425 SetOwnerState(false, false); |
| 426 // Remove the real DeviceSettingsProvider and replace it with a stub. |
| 427 CrosSettingsProvider* device_settings_provider = |
| 428 CrosSettings::Get()->GetProvider(chromeos::kReportDeviceVersionInfo); |
| 429 EXPECT_TRUE(device_settings_provider != NULL); |
| 430 EXPECT_TRUE( |
| 431 CrosSettings::Get()->RemoveSettingsProvider(device_settings_provider)); |
| 432 StubCrosSettingsProvider stub_settings_provider; |
| 433 CrosSettings::Get()->AddSettingsProvider(&stub_settings_provider); |
| 434 CrosSettings::Get()->SetBoolean(kPolicyMissingMitigationMode, true); |
| 435 |
| 436 // Initialize login state for this test to verify the login state is changed |
| 437 // to SAFE_MODE. |
| 438 LoginState::Initialize(); |
| 439 |
| 440 EXPECT_EQ(ParallelAuthenticator::CONTINUE, |
| 441 SetAndResolveState(auth_.get(), state_.release())); |
| 442 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); |
| 443 |
| 444 // Flush all the pending operations. The operations should induce an owner |
| 445 // verification. |
| 446 device_settings_test_helper_.Flush(); |
| 447 |
| 448 state_.reset(new TestAttemptState(user_context_, false)); |
| 449 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| 450 |
| 451 // The owner key util should find the owner key, so login should succeed. |
| 452 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, |
| 453 SetAndResolveState(auth_.get(), state_.release())); |
| 454 EXPECT_TRUE(LoginState::Get()->IsInSafeMode()); |
| 455 |
| 456 // Unset global objects used by this test. |
| 457 fake_cryptohome_client_->set_unmount_result(true); |
| 458 LoginState::Shutdown(); |
| 459 EXPECT_TRUE( |
| 460 CrosSettings::Get()->RemoveSettingsProvider(&stub_settings_provider)); |
341 CrosSettings::Get()->AddSettingsProvider(device_settings_provider); | 461 CrosSettings::Get()->AddSettingsProvider(device_settings_provider); |
342 } | 462 } |
343 | 463 |
344 TEST_F(ParallelAuthenticatorTest, DriveFailedMount) { | 464 TEST_F(ParallelAuthenticatorTest, DriveFailedMount) { |
345 FailOnLoginSuccess(); | 465 FailOnLoginSuccess(); |
346 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); | 466 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); |
347 | 467 |
348 // Set up state as though a cryptohome mount attempt has occurred | 468 // Set up state as though a cryptohome mount attempt has occurred |
349 // and failed. | 469 // and failed. |
350 state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_NONE); | 470 state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_NONE); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 735 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
616 EXPECT_CALL(*mock_caller_, AsyncCheckKey(user_context_.GetUserID(), _, _)) | 736 EXPECT_CALL(*mock_caller_, AsyncCheckKey(user_context_.GetUserID(), _, _)) |
617 .Times(1) | 737 .Times(1) |
618 .RetiresOnSaturation(); | 738 .RetiresOnSaturation(); |
619 | 739 |
620 auth_->AuthenticateToUnlock(user_context_); | 740 auth_->AuthenticateToUnlock(user_context_); |
621 base::MessageLoop::current()->Run(); | 741 base::MessageLoop::current()->Run(); |
622 } | 742 } |
623 | 743 |
624 } // namespace chromeos | 744 } // namespace chromeos |
OLD | NEW |