OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "chrome/browser/chromeos/cros/network_library.h" | 15 #include "chrome/browser/chromeos/cros/network_library.h" |
16 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" |
17 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" | 17 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" |
18 #include "chrome/browser/chromeos/login/mock_user_manager.h" | 18 #include "chrome/browser/chromeos/login/mock_user_manager.h" |
19 #include "chrome/browser/chromeos/login/test_attempt_state.h" | 19 #include "chrome/browser/chromeos/login/test_attempt_state.h" |
20 #include "chrome/browser/chromeos/login/user.h" | 20 #include "chrome/browser/chromeos/login/user.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 23 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
24 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 24 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
26 #include "chromeos/cryptohome/mock_async_method_caller.h" | 26 #include "chromeos/cryptohome/mock_async_method_caller.h" |
27 #include "chromeos/cryptohome/mock_cryptohome_library.h" | 27 #include "chromeos/cryptohome/mock_cryptohome_library.h" |
28 #include "chromeos/dbus/fake_cryptohome_client.h" | 28 #include "chromeos/dbus/fake_cryptohome_client.h" |
29 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" | 29 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
30 #include "content/public/test/test_browser_thread.h" | 30 #include "content/public/test/test_browser_thread_bundle.h" |
31 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 31 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
32 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
33 #include "net/url_request/url_request_status.h" | 33 #include "net/url_request/url_request_status.h" |
34 #include "testing/gmock/include/gmock/gmock.h" | 34 #include "testing/gmock/include/gmock/gmock.h" |
35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
36 #include "third_party/cros_system_api/dbus/service_constants.h" | 36 #include "third_party/cros_system_api/dbus/service_constants.h" |
37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
38 | 38 |
39 using ::testing::AnyNumber; | |
40 using ::testing::DoAll; | |
41 using ::testing::Invoke; | 39 using ::testing::Invoke; |
42 using ::testing::Return; | 40 using ::testing::Return; |
43 using ::testing::SetArgPointee; | |
44 using ::testing::_; | 41 using ::testing::_; |
45 using content::BrowserThread; | |
46 | 42 |
47 namespace chromeos { | 43 namespace chromeos { |
48 | 44 |
49 class TestOnlineAttempt : public OnlineAttempt { | 45 class TestOnlineAttempt : public OnlineAttempt { |
50 public: | 46 public: |
51 TestOnlineAttempt(AuthAttemptState* state, | 47 TestOnlineAttempt(AuthAttemptState* state, |
52 AuthAttemptStateResolver* resolver) | 48 AuthAttemptStateResolver* resolver) |
53 : OnlineAttempt(state, resolver) { | 49 : OnlineAttempt(state, resolver) { |
54 } | 50 } |
55 }; | 51 }; |
56 | 52 |
57 class ParallelAuthenticatorTest : public testing::Test { | 53 class ParallelAuthenticatorTest : public testing::Test { |
58 public: | 54 public: |
59 ParallelAuthenticatorTest() | 55 ParallelAuthenticatorTest() |
60 : message_loop_(base::MessageLoop::TYPE_UI), | 56 : username_("me@nowhere.org"), |
61 ui_thread_(BrowserThread::UI, &message_loop_), | |
62 file_thread_(BrowserThread::FILE, &message_loop_), | |
63 io_thread_(BrowserThread::IO), | |
64 username_("me@nowhere.org"), | |
65 password_("fakepass"), | 57 password_("fakepass"), |
| 58 hash_ascii_("0a010000000000a0" + std::string(16, '0')), |
66 user_manager_enabler_(new MockUserManager) { | 59 user_manager_enabler_(new MockUserManager) { |
67 hash_ascii_.assign("0a010000000000a0"); | |
68 hash_ascii_.append(std::string(16, '0')); | |
69 } | 60 } |
70 | 61 |
71 virtual ~ParallelAuthenticatorTest() { | 62 virtual ~ParallelAuthenticatorTest() { |
72 DCHECK(!mock_caller_); | 63 DCHECK(!mock_caller_); |
73 } | 64 } |
74 | 65 |
75 virtual void SetUp() { | 66 virtual void SetUp() { |
76 mock_caller_ = new cryptohome::MockAsyncMethodCaller; | 67 mock_caller_ = new cryptohome::MockAsyncMethodCaller; |
77 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); | 68 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); |
78 | 69 |
79 mock_cryptohome_library_ .reset(new MockCryptohomeLibrary()); | 70 mock_cryptohome_library_ .reset(new MockCryptohomeLibrary()); |
80 CryptohomeLibrary::SetForTest(mock_cryptohome_library_.get()); | 71 CryptohomeLibrary::SetForTest(mock_cryptohome_library_.get()); |
81 | 72 |
82 io_thread_.Start(); | |
83 | |
84 auth_ = new ParallelAuthenticator(&consumer_); | 73 auth_ = new ParallelAuthenticator(&consumer_); |
85 state_.reset(new TestAttemptState(UserContext(username_, | 74 state_.reset(new TestAttemptState(UserContext(username_, |
86 password_, | 75 password_, |
87 std::string()), | 76 std::string()), |
88 hash_ascii_, | 77 hash_ascii_, |
89 "", | 78 "", |
90 "", | 79 "", |
91 User::USER_TYPE_REGULAR, | 80 User::USER_TYPE_REGULAR, |
92 false)); | 81 false)); |
93 } | 82 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 159 } |
171 | 160 |
172 void ExpectPasswordChange() { | 161 void ExpectPasswordChange() { |
173 EXPECT_CALL(consumer_, OnPasswordChangeDetected()) | 162 EXPECT_CALL(consumer_, OnPasswordChangeDetected()) |
174 .WillOnce(Invoke(MockConsumer::OnMigrateQuit)) | 163 .WillOnce(Invoke(MockConsumer::OnMigrateQuit)) |
175 .RetiresOnSaturation(); | 164 .RetiresOnSaturation(); |
176 } | 165 } |
177 | 166 |
178 void RunResolve(ParallelAuthenticator* auth) { | 167 void RunResolve(ParallelAuthenticator* auth) { |
179 auth->Resolve(); | 168 auth->Resolve(); |
180 message_loop_.RunUntilIdle(); | 169 base::MessageLoop::current()->RunUntilIdle(); |
181 } | 170 } |
182 | 171 |
183 void SetAttemptState(ParallelAuthenticator* auth, TestAttemptState* state) { | 172 void SetAttemptState(ParallelAuthenticator* auth, TestAttemptState* state) { |
184 auth->set_attempt_state(state); | 173 auth->set_attempt_state(state); |
185 } | 174 } |
186 | 175 |
187 ParallelAuthenticator::AuthState SetAndResolveState( | 176 ParallelAuthenticator::AuthState SetAndResolveState( |
188 ParallelAuthenticator* auth, TestAttemptState* state) { | 177 ParallelAuthenticator* auth, TestAttemptState* state) { |
189 auth->set_attempt_state(state); | 178 auth->set_attempt_state(state); |
190 return auth->ResolveState(); | 179 return auth->ResolveState(); |
191 } | 180 } |
192 | 181 |
193 void SetOwnerState(bool owner_check_finished, bool check_result) { | 182 void SetOwnerState(bool owner_check_finished, bool check_result) { |
194 auth_->SetOwnerState(owner_check_finished, check_result); | 183 auth_->SetOwnerState(owner_check_finished, check_result); |
195 } | 184 } |
196 | 185 |
197 void FakeOnlineAttempt() { | 186 void FakeOnlineAttempt() { |
198 auth_->set_online_attempt(new TestOnlineAttempt(state_.get(), auth_.get())); | 187 auth_->set_online_attempt(new TestOnlineAttempt(state_.get(), auth_.get())); |
199 } | 188 } |
200 | 189 |
201 base::MessageLoop message_loop_; | 190 content::TestBrowserThreadBundle thread_bundle_; |
202 content::TestBrowserThread ui_thread_; | |
203 content::TestBrowserThread file_thread_; | |
204 content::TestBrowserThread io_thread_; | |
205 | 191 |
206 std::string username_; | 192 std::string username_; |
207 std::string password_; | 193 std::string password_; |
208 std::string username_hash_; | 194 std::string username_hash_; |
209 std::string hash_ascii_; | 195 std::string hash_ascii_; |
210 | 196 |
211 ScopedStubNetworkLibraryEnabler stub_network_library_enabler_; | 197 ScopedStubNetworkLibraryEnabler stub_network_library_enabler_; |
212 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 198 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
213 ScopedTestCrosSettings test_cros_settings_; | 199 ScopedTestCrosSettings test_cros_settings_; |
214 | 200 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 FailOnLoginFailure(); | 369 FailOnLoginFailure(); |
384 | 370 |
385 // Set up mock cryptohome library to respond as though a tmpfs mount | 371 // Set up mock cryptohome library to respond as though a tmpfs mount |
386 // attempt has occurred and succeeded. | 372 // attempt has occurred and succeeded. |
387 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 373 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
388 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) | 374 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) |
389 .Times(1) | 375 .Times(1) |
390 .RetiresOnSaturation(); | 376 .RetiresOnSaturation(); |
391 | 377 |
392 auth_->LoginOffTheRecord(); | 378 auth_->LoginOffTheRecord(); |
393 message_loop_.Run(); | 379 base::MessageLoop::current()->Run(); |
394 } | 380 } |
395 | 381 |
396 TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) { | 382 TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) { |
397 FailOnGuestLoginSuccess(); | 383 FailOnGuestLoginSuccess(); |
398 ExpectLoginFailure(LoginFailure(LoginFailure::COULD_NOT_MOUNT_TMPFS)); | 384 ExpectLoginFailure(LoginFailure(LoginFailure::COULD_NOT_MOUNT_TMPFS)); |
399 | 385 |
400 // Set up mock cryptohome library to respond as though a tmpfs mount | 386 // Set up mock cryptohome library to respond as though a tmpfs mount |
401 // attempt has occurred and failed. | 387 // attempt has occurred and failed. |
402 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); | 388 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); |
403 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) | 389 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) |
404 .Times(1) | 390 .Times(1) |
405 .RetiresOnSaturation(); | 391 .RetiresOnSaturation(); |
406 | 392 |
407 auth_->LoginOffTheRecord(); | 393 auth_->LoginOffTheRecord(); |
408 message_loop_.Run(); | 394 base::MessageLoop::current()->Run(); |
409 } | 395 } |
410 | 396 |
411 TEST_F(ParallelAuthenticatorTest, DriveRetailModeUserLogin) { | 397 TEST_F(ParallelAuthenticatorTest, DriveRetailModeUserLogin) { |
412 ExpectRetailModeLoginSuccess(); | 398 ExpectRetailModeLoginSuccess(); |
413 FailOnLoginFailure(); | 399 FailOnLoginFailure(); |
414 | 400 |
415 // Set up mock cryptohome library to respond as though a tmpfs mount | 401 // Set up mock cryptohome library to respond as though a tmpfs mount |
416 // attempt has occurred and succeeded. | 402 // attempt has occurred and succeeded. |
417 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 403 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
418 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) | 404 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) |
419 .Times(1) | 405 .Times(1) |
420 .RetiresOnSaturation(); | 406 .RetiresOnSaturation(); |
421 | 407 |
422 auth_->LoginRetailMode(); | 408 auth_->LoginRetailMode(); |
423 message_loop_.Run(); | 409 base::MessageLoop::current()->Run(); |
424 } | 410 } |
425 | 411 |
426 TEST_F(ParallelAuthenticatorTest, DriveRetailModeLoginButFail) { | 412 TEST_F(ParallelAuthenticatorTest, DriveRetailModeLoginButFail) { |
427 FailOnRetailModeLoginSuccess(); | 413 FailOnRetailModeLoginSuccess(); |
428 ExpectLoginFailure(LoginFailure(LoginFailure::COULD_NOT_MOUNT_TMPFS)); | 414 ExpectLoginFailure(LoginFailure(LoginFailure::COULD_NOT_MOUNT_TMPFS)); |
429 | 415 |
430 // Set up mock cryptohome library to respond as though a tmpfs mount | 416 // Set up mock cryptohome library to respond as though a tmpfs mount |
431 // attempt has occurred and failed. | 417 // attempt has occurred and failed. |
432 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); | 418 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); |
433 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) | 419 EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)) |
434 .Times(1) | 420 .Times(1) |
435 .RetiresOnSaturation(); | 421 .RetiresOnSaturation(); |
436 | 422 |
437 auth_->LoginRetailMode(); | 423 auth_->LoginRetailMode(); |
438 message_loop_.Run(); | 424 base::MessageLoop::current()->Run(); |
439 } | 425 } |
440 | 426 |
441 TEST_F(ParallelAuthenticatorTest, DriveDataResync) { | 427 TEST_F(ParallelAuthenticatorTest, DriveDataResync) { |
442 ExpectLoginSuccess(username_, | 428 ExpectLoginSuccess(username_, |
443 password_, | 429 password_, |
444 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername, | 430 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername, |
445 false); | 431 false); |
446 FailOnLoginFailure(); | 432 FailOnLoginFailure(); |
447 | 433 |
448 // Set up mock cryptohome library to respond successfully to a cryptohome | 434 // Set up mock cryptohome library to respond successfully to a cryptohome |
449 // remove attempt and a cryptohome create attempt (indicated by the | 435 // remove attempt and a cryptohome create attempt (indicated by the |
450 // |CREATE_IF_MISSING| flag to AsyncMount). | 436 // |CREATE_IF_MISSING| flag to AsyncMount). |
451 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 437 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
452 EXPECT_CALL(*mock_caller_, AsyncRemove(username_, _)) | 438 EXPECT_CALL(*mock_caller_, AsyncRemove(username_, _)) |
453 .Times(1) | 439 .Times(1) |
454 .RetiresOnSaturation(); | 440 .RetiresOnSaturation(); |
455 EXPECT_CALL(*mock_caller_, AsyncMount(username_, hash_ascii_, | 441 EXPECT_CALL(*mock_caller_, AsyncMount(username_, hash_ascii_, |
456 cryptohome::CREATE_IF_MISSING, _)) | 442 cryptohome::CREATE_IF_MISSING, _)) |
457 .Times(1) | 443 .Times(1) |
458 .RetiresOnSaturation(); | 444 .RetiresOnSaturation(); |
459 EXPECT_CALL(*mock_caller_, AsyncGetSanitizedUsername(username_, _)) | 445 EXPECT_CALL(*mock_caller_, AsyncGetSanitizedUsername(username_, _)) |
460 .Times(1) | 446 .Times(1) |
461 .RetiresOnSaturation(); | 447 .RetiresOnSaturation(); |
462 | 448 |
463 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); | 449 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); |
464 SetAttemptState(auth_.get(), state_.release()); | 450 SetAttemptState(auth_.get(), state_.release()); |
465 | 451 |
466 auth_->ResyncEncryptedData(); | 452 auth_->ResyncEncryptedData(); |
467 message_loop_.Run(); | 453 base::MessageLoop::current()->Run(); |
468 } | 454 } |
469 | 455 |
470 TEST_F(ParallelAuthenticatorTest, DriveResyncFail) { | 456 TEST_F(ParallelAuthenticatorTest, DriveResyncFail) { |
471 FailOnLoginSuccess(); | 457 FailOnLoginSuccess(); |
472 ExpectLoginFailure(LoginFailure(LoginFailure::DATA_REMOVAL_FAILED)); | 458 ExpectLoginFailure(LoginFailure(LoginFailure::DATA_REMOVAL_FAILED)); |
473 | 459 |
474 // Set up mock cryptohome library to fail a cryptohome remove attempt. | 460 // Set up mock cryptohome library to fail a cryptohome remove attempt. |
475 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); | 461 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_NONE); |
476 EXPECT_CALL(*mock_caller_, AsyncRemove(username_, _)) | 462 EXPECT_CALL(*mock_caller_, AsyncRemove(username_, _)) |
477 .Times(1) | 463 .Times(1) |
478 .RetiresOnSaturation(); | 464 .RetiresOnSaturation(); |
479 | 465 |
480 SetAttemptState(auth_.get(), state_.release()); | 466 SetAttemptState(auth_.get(), state_.release()); |
481 | 467 |
482 auth_->ResyncEncryptedData(); | 468 auth_->ResyncEncryptedData(); |
483 message_loop_.Run(); | 469 base::MessageLoop::current()->Run(); |
484 } | 470 } |
485 | 471 |
486 TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) { | 472 TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) { |
487 FailOnLoginSuccess(); | 473 FailOnLoginSuccess(); |
488 ExpectPasswordChange(); | 474 ExpectPasswordChange(); |
489 | 475 |
490 state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); | 476 state_->PresetCryptohomeStatus(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); |
491 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); | 477 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); |
492 SetAttemptState(auth_.get(), state_.release()); | 478 SetAttemptState(auth_.get(), state_.release()); |
493 | 479 |
(...skipping 20 matching lines...) Expand all Loading... |
514 .Times(1) | 500 .Times(1) |
515 .RetiresOnSaturation(); | 501 .RetiresOnSaturation(); |
516 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) | 502 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) |
517 .WillOnce(Return(std::string())) | 503 .WillOnce(Return(std::string())) |
518 .RetiresOnSaturation(); | 504 .RetiresOnSaturation(); |
519 | 505 |
520 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); | 506 state_->PresetOnlineLoginStatus(LoginFailure::LoginFailureNone()); |
521 SetAttemptState(auth_.get(), state_.release()); | 507 SetAttemptState(auth_.get(), state_.release()); |
522 | 508 |
523 auth_->RecoverEncryptedData(std::string()); | 509 auth_->RecoverEncryptedData(std::string()); |
524 message_loop_.Run(); | 510 base::MessageLoop::current()->Run(); |
525 } | 511 } |
526 | 512 |
527 TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) { | 513 TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) { |
528 FailOnLoginSuccess(); | 514 FailOnLoginSuccess(); |
529 ExpectPasswordChange(); | 515 ExpectPasswordChange(); |
530 | 516 |
531 // Set up mock cryptohome library to fail a key migration attempt, | 517 // Set up mock cryptohome library to fail a key migration attempt, |
532 // asserting that the wrong password was used. | 518 // asserting that the wrong password was used. |
533 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); | 519 mock_caller_->SetUp(false, cryptohome::MOUNT_ERROR_KEY_FAILURE); |
534 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _)) | 520 EXPECT_CALL(*mock_caller_, AsyncMigrateKey(username_, _, hash_ascii_, _)) |
535 .Times(1) | 521 .Times(1) |
536 .RetiresOnSaturation(); | 522 .RetiresOnSaturation(); |
537 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) | 523 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) |
538 .WillOnce(Return(std::string())) | 524 .WillOnce(Return(std::string())) |
539 .RetiresOnSaturation(); | 525 .RetiresOnSaturation(); |
540 | 526 |
541 SetAttemptState(auth_.get(), state_.release()); | 527 SetAttemptState(auth_.get(), state_.release()); |
542 | 528 |
543 auth_->RecoverEncryptedData(std::string()); | 529 auth_->RecoverEncryptedData(std::string()); |
544 message_loop_.Run(); | 530 base::MessageLoop::current()->Run(); |
545 } | 531 } |
546 | 532 |
547 TEST_F(ParallelAuthenticatorTest, ResolveNoMount) { | 533 TEST_F(ParallelAuthenticatorTest, ResolveNoMount) { |
548 // Set a fake online attempt so that we return intermediate cryptohome state. | 534 // Set a fake online attempt so that we return intermediate cryptohome state. |
549 FakeOnlineAttempt(); | 535 FakeOnlineAttempt(); |
550 | 536 |
551 // Set up state as though a cryptohome mount attempt has occurred | 537 // Set up state as though a cryptohome mount attempt has occurred |
552 // and been rejected because the user doesn't exist. | 538 // and been rejected because the user doesn't exist. |
553 state_->PresetCryptohomeStatus(false, | 539 state_->PresetCryptohomeStatus(false, |
554 cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); | 540 cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 EXPECT_CALL(*mock_caller_, AsyncCheckKey(username_, _, _)) | 631 EXPECT_CALL(*mock_caller_, AsyncCheckKey(username_, _, _)) |
646 .Times(1) | 632 .Times(1) |
647 .RetiresOnSaturation(); | 633 .RetiresOnSaturation(); |
648 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) | 634 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) |
649 .WillOnce(Return(std::string())) | 635 .WillOnce(Return(std::string())) |
650 .RetiresOnSaturation(); | 636 .RetiresOnSaturation(); |
651 | 637 |
652 auth_->AuthenticateToUnlock(UserContext(username_, | 638 auth_->AuthenticateToUnlock(UserContext(username_, |
653 std::string(), | 639 std::string(), |
654 std::string())); | 640 std::string())); |
655 message_loop_.Run(); | 641 base::MessageLoop::current()->Run(); |
656 } | 642 } |
657 | 643 |
658 } // namespace chromeos | 644 } // namespace chromeos |
OLD | NEW |