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

Unified Diff: chromeos/dbus/fake_cryptohome_client.h

Issue 24637004: cryptohome: Merge FakeCryptohomeClient and CryptohomeClinentStubImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the build Created 7 years, 3 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
« no previous file with comments | « chromeos/dbus/cryptohome_client_stub.cc ('k') | chromeos/dbus/fake_cryptohome_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_cryptohome_client.h
diff --git a/chromeos/dbus/fake_cryptohome_client.h b/chromeos/dbus/fake_cryptohome_client.h
index 74d9e81098d5c50fb19d08e583e911ebc2ba7aea..26e2cc8c11b7a7390d5ffd48e727bfe597a16f0a 100644
--- a/chromeos/dbus/fake_cryptohome_client.h
+++ b/chromeos/dbus/fake_cryptohome_client.h
@@ -1,24 +1,23 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_
#define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_
-#include <string>
+#include <map>
+#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
#include "chromeos/dbus/cryptohome_client.h"
namespace chromeos {
-// A fake implementation of CryptohomeClient. This only calls callbacks given
-// as parameters.
-class FakeCryptohomeClient : public CryptohomeClient {
+class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient {
public:
FakeCryptohomeClient();
virtual ~FakeCryptohomeClient();
- // CryptohomeClient overrides
virtual void Init(dbus::Bus* bus) OVERRIDE;
virtual void SetAsyncCallStatusHandlers(
const AsyncCallStatusHandler& handler,
@@ -83,9 +82,9 @@ class FakeCryptohomeClient : public CryptohomeClient {
virtual bool InstallAttributesIsInvalid(bool* is_invalid) OVERRIDE;
virtual bool InstallAttributesIsFirstInstall(bool* is_first_install) OVERRIDE;
virtual void TpmAttestationIsPrepared(
- const BoolDBusMethodCallback& callback) OVERRIDE;
+ const BoolDBusMethodCallback& callback) OVERRIDE;
virtual void TpmAttestationIsEnrolled(
- const BoolDBusMethodCallback& callback) OVERRIDE;
+ const BoolDBusMethodCallback& callback) OVERRIDE;
virtual void AsyncTpmAttestationCreateEnrollRequest(
const AsyncMethodCallback& callback) OVERRIDE;
virtual void AsyncTpmAttestationEnroll(
@@ -140,18 +139,32 @@ class FakeCryptohomeClient : public CryptohomeClient {
const std::string& payload,
const BoolDBusMethodCallback& callback) OVERRIDE;
- // Sets the unmount result of Unmount() call. Unmount() always sets the result
- // and pretends that the underlying method call succeeds.
+ // Sets the unmount result of Unmount() call.
void set_unmount_result(bool result) {
unmount_result_= result;
}
private:
- AsyncCallStatusHandler handler_;
- AsyncCallStatusWithDataHandler data_handler_;
+ // Posts tasks which return fake results to the UI thread.
+ void ReturnAsyncMethodResult(const AsyncMethodCallback& callback,
+ bool returns_data);
+ // This method is used to implement ReturnAsyncMethodResult.
+ void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback,
+ bool returns_data);
+
+ int async_call_id_;
+ AsyncCallStatusHandler async_call_status_handler_;
+ AsyncCallStatusWithDataHandler async_call_status_data_handler_;
+ int tpm_is_ready_counter_;
bool unmount_result_;
+ // A stub store for InstallAttributes, mapping an attribute name to the
+ // associated data blob. Used to implement InstallAttributesSet and -Get.
+ std::map<std::string, std::vector<uint8> > install_attrs_;
+ bool locked_;
+ base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient);
};
« no previous file with comments | « chromeos/dbus/cryptohome_client_stub.cc ('k') | chromeos/dbus/fake_cryptohome_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698