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

Side by Side Diff: chromeos/cryptohome/mock_async_method_caller.h

Issue 11932004: Implemented attestation message flow for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_ 5 #ifndef CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_
6 #define CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_ 6 #define CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "chromeos/cryptohome/async_method_caller.h" 12 #include "chromeos/cryptohome/async_method_caller.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 14
15 namespace cryptohome { 15 namespace cryptohome {
16 16
17 class MockAsyncMethodCaller : public AsyncMethodCaller { 17 class MockAsyncMethodCaller : public AsyncMethodCaller {
18 public: 18 public:
19 static const char* kFakeAttestationEnrollRequest;
satorux1 2013/01/15 23:04:13 nit: please do the following for consistency stat
dkrahn 2013/01/17 23:36:24 Done.
20 static const char* kFakeAttestationCertRequest;
21 static const char* kFakeAttestationCert;
22
19 MockAsyncMethodCaller(); 23 MockAsyncMethodCaller();
20 virtual ~MockAsyncMethodCaller(); 24 virtual ~MockAsyncMethodCaller();
21 25
22 void SetUp(bool success, MountError return_code); 26 void SetUp(bool success, MountError return_code);
23 27
24 MOCK_METHOD3(AsyncCheckKey, void(const std::string& user_email, 28 MOCK_METHOD3(AsyncCheckKey, void(const std::string& user_email,
25 const std::string& passhash, 29 const std::string& passhash,
26 Callback callback)); 30 Callback callback));
27 MOCK_METHOD4(AsyncMigrateKey, void(const std::string& user_email, 31 MOCK_METHOD4(AsyncMigrateKey, void(const std::string& user_email,
28 const std::string& old_hash, 32 const std::string& old_hash,
(...skipping 14 matching lines...) Expand all
43 void(bool is_cert_for_owner, const DataCallback& callback)); 47 void(bool is_cert_for_owner, const DataCallback& callback));
44 MOCK_METHOD2(AsyncTpmAttestationFinishCertRequest, 48 MOCK_METHOD2(AsyncTpmAttestationFinishCertRequest,
45 void(const std::string& pca_response, 49 void(const std::string& pca_response,
46 const DataCallback& callback)); 50 const DataCallback& callback));
47 51
48 private: 52 private:
49 bool success_; 53 bool success_;
50 MountError return_code_; 54 MountError return_code_;
51 55
52 void DoCallback(Callback callback); 56 void DoCallback(Callback callback);
57 // Default fakes for attestation calls.
58 void FakeCreateEnrollRequest(const DataCallback& callback);
59 void FakeCreateCertRequest(const DataCallback& callback);
60 void FakeFinishCertRequest(const DataCallback& callback);
53 61
54 DISALLOW_COPY_AND_ASSIGN(MockAsyncMethodCaller); 62 DISALLOW_COPY_AND_ASSIGN(MockAsyncMethodCaller);
55 }; 63 };
56 64
57 } // namespace cryptohome 65 } // namespace cryptohome
58 66
59 #endif // CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_ 67 #endif // CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698