Revert 215785 "[telemetry] Add a webdriver backend with support ..."
[chromium-blink-merge.git] / chromeos / cryptohome / mock_async_method_caller.h
blob74567cafb048f514e6370f06d9b53c1e5aab6521
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_
6 #define CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "chromeos/cryptohome/async_method_caller.h"
13 #include "testing/gmock/include/gmock/gmock.h"
15 namespace cryptohome {
17 class MockAsyncMethodCaller : public AsyncMethodCaller {
18 public:
19 static const char kFakeAttestationEnrollRequest[];
20 static const char kFakeAttestationCertRequest[];
21 static const char kFakeAttestationCert[];
22 static const char kFakeSanitizedUsername[];
23 static const char kFakeChallengeResponse[];
25 MockAsyncMethodCaller();
26 virtual ~MockAsyncMethodCaller();
28 void SetUp(bool success, MountError return_code);
30 MOCK_METHOD3(AsyncCheckKey, void(const std::string& user_email,
31 const std::string& passhash,
32 Callback callback));
33 MOCK_METHOD4(AsyncMigrateKey, void(const std::string& user_email,
34 const std::string& old_hash,
35 const std::string& new_hash,
36 Callback callback));
37 MOCK_METHOD4(AsyncMount, void(const std::string& user_email,
38 const std::string& passhash,
39 int flags,
40 Callback callback));
41 MOCK_METHOD4(AsyncAddKey, void(const std::string& user_email,
42 const std::string& passhash,
43 const std::string& new_key,
44 Callback callback));
45 MOCK_METHOD1(AsyncMountGuest, void(Callback callback));
46 MOCK_METHOD3(AsyncMountPublic, void(const std::string& public_mount_id,
47 int flags,
48 Callback callback));
49 MOCK_METHOD2(AsyncRemove, void(const std::string& user_email,
50 Callback callback));
51 MOCK_METHOD1(AsyncTpmAttestationCreateEnrollRequest,
52 void(const DataCallback& callback));
53 MOCK_METHOD2(AsyncTpmAttestationEnroll,
54 void(const std::string& pca_response, const Callback& callback));
55 MOCK_METHOD2(AsyncTpmAttestationCreateCertRequest,
56 void(int options,
57 const DataCallback& callback));
58 MOCK_METHOD4(AsyncTpmAttestationFinishCertRequest,
59 void(const std::string& pca_response,
60 chromeos::attestation::AttestationKeyType key_type,
61 const std::string& key_name,
62 const DataCallback& callback));
63 MOCK_METHOD3(TpmAttestationRegisterKey,
64 void(chromeos::attestation::AttestationKeyType key_type,
65 const std::string& key_name,
66 const Callback& callback));
67 MOCK_METHOD7(
68 TpmAttestationSignEnterpriseChallenge,
69 void(chromeos::attestation::AttestationKeyType key_type,
70 const std::string& key_name,
71 const std::string& domain,
72 const std::string& device_id,
73 chromeos::attestation::AttestationChallengeOptions options,
74 const std::string& challenge,
75 const DataCallback& callback));
76 MOCK_METHOD4(TpmAttestationSignSimpleChallenge,
77 void(chromeos::attestation::AttestationKeyType key_type,
78 const std::string& key_name,
79 const std::string& challenge,
80 const DataCallback& callback));
81 MOCK_METHOD2(AsyncGetSanitizedUsername,
82 void(const std::string& user,
83 const DataCallback& callback));
85 private:
86 bool success_;
87 MountError return_code_;
89 void DoCallback(Callback callback);
90 // Default fakes for attestation calls.
91 void FakeCreateEnrollRequest(const DataCallback& callback);
92 void FakeCreateCertRequest(const DataCallback& callback);
93 void FakeFinishCertRequest(const DataCallback& callback);
94 void FakeGetSanitizedUsername(const DataCallback& callback);
95 void FakeEnterpriseChallenge(const DataCallback& callback);
97 DISALLOW_COPY_AND_ASSIGN(MockAsyncMethodCaller);
100 } // namespace cryptohome
102 #endif // CHROMEOS_CRYPTOHOME_MOCK_ASYNC_METHOD_CALLER_H_