Chromium Code Reviews| 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 "chromeos/cryptohome/system_salt_getter.h" | 5 #include "chromeos/cryptohome/system_salt_getter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chromeos/dbus/fake_cryptohome_client.h" | 10 #include "chromeos/dbus/fake_cryptohome_client.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // Try to get system salt before the service becomes available. | 48 // Try to get system salt before the service becomes available. |
| 49 fake_cryptohome_client_->SetServiceIsAvailable(false); | 49 fake_cryptohome_client_->SetServiceIsAvailable(false); |
| 50 std::string system_salt; | 50 std::string system_salt; |
| 51 SystemSaltGetter::Get()->GetSystemSalt( | 51 SystemSaltGetter::Get()->GetSystemSalt( |
| 52 base::Bind(&CopySystemSalt, &system_salt)); | 52 base::Bind(&CopySystemSalt, &system_salt)); |
| 53 base::RunLoop().RunUntilIdle(); | 53 base::RunLoop().RunUntilIdle(); |
| 54 EXPECT_TRUE(system_salt.empty()); // System salt is not returned yet. | 54 EXPECT_TRUE(system_salt.empty()); // System salt is not returned yet. |
| 55 | 55 |
| 56 // Service becomes available. | 56 // Service becomes available. |
| 57 fake_cryptohome_client_->SetServiceIsAvailable(true); | 57 fake_cryptohome_client_->SetServiceIsAvailable(true); |
| 58 base::RunLoop().RunUntilIdle(); | |
|
hashimoto
2013/10/25 11:06:55
Test was failing because message loop was not run.
| |
| 58 const std::string expected_system_salt = | 59 const std::string expected_system_salt = |
| 59 SystemSaltGetter::ConvertRawSaltToHexString( | 60 SystemSaltGetter::ConvertRawSaltToHexString( |
| 60 FakeCryptohomeClient::GetStubSystemSalt()); | 61 FakeCryptohomeClient::GetStubSystemSalt()); |
| 61 EXPECT_EQ(expected_system_salt, system_salt); // System salt is returned. | 62 EXPECT_EQ(expected_system_salt, system_salt); // System salt is returned. |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace | 65 } // namespace |
| 65 } // namespace chromeos | 66 } // namespace chromeos |
| OLD | NEW |