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

Unified Diff: chromeos/dbus/mock_dbus_thread_manager.cc

Issue 43503003: chromeos: Remove SystemSaltGetter::GetSystemSaltSync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/mock_dbus_thread_manager.cc
diff --git a/chromeos/dbus/mock_dbus_thread_manager.cc b/chromeos/dbus/mock_dbus_thread_manager.cc
index 61cac7e722ad1aa26923baff2fd4aeeca56c3630..61431d6ad73842b43d12f9d3ec3eb1ea5c31500d 100644
--- a/chromeos/dbus/mock_dbus_thread_manager.cc
+++ b/chromeos/dbus/mock_dbus_thread_manager.cc
@@ -4,6 +4,7 @@
#include "chromeos/dbus/mock_dbus_thread_manager.h"
+#include "base/message_loop/message_loop.h"
#include "chromeos/dbus/dbus_thread_manager_observer.h"
#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
@@ -25,24 +26,25 @@
#include "chromeos/dbus/power_policy_controller.h"
using ::testing::AnyNumber;
+using ::testing::Invoke;
using ::testing::Return;
using ::testing::ReturnNull;
-using ::testing::SetArgumentPointee;
using ::testing::_;
namespace chromeos {
namespace {
-std::vector<uint8>* GetMockSystemSalt() {
- static std::vector<uint8>* s_system_salt = NULL;
- if (!s_system_salt) {
- const char kStubSystemSalt[] = "stub_system_salt";
- s_system_salt = new std::vector<uint8>();
- s_system_salt->assign(kStubSystemSalt,
- kStubSystemSalt + arraysize(kStubSystemSalt) - 1);
- }
- return s_system_salt;
+void GetMockSystemSalt(
+ const CryptohomeClient::GetSystemSaltCallback& callback) {
+ const char kStubSystemSalt[] = "stub_system_salt";
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback,
+ DBUS_METHOD_CALL_SUCCESS,
+ std::vector<uint8>(
+ kStubSystemSalt,
+ kStubSystemSalt + arraysize(kStubSystemSalt) - 1)));
}
} // namespace
@@ -113,8 +115,7 @@ MockDBusThreadManager::MockDBusThreadManager()
.Times(AnyNumber());
// Called from various locations.
EXPECT_CALL(*mock_cryptohome_client_.get(), GetSystemSalt(_))
- .WillRepeatedly(DoAll(SetArgumentPointee<0>(*GetMockSystemSalt()),
- Return(true)));
+ .WillRepeatedly(Invoke(&GetMockSystemSalt));
EXPECT_CALL(*mock_cryptohome_client_.get(), TpmIsEnabled(_))
.Times(AnyNumber());
« chromeos/cryptohome/system_salt_getter_unittest.cc ('K') | « chromeos/dbus/mock_cryptohome_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698