Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 #ifndef COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H | |
| 6 #define COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" | |
| 10 | |
| 11 namespace proximity_auth { | |
| 12 | |
| 13 // Fake implementation of SecureMessageDelegate used in tests. | |
| 14 // For clarity in tests, all functions in this delegate will invoke their | |
| 15 // callback with the result before returning. | |
| 16 class FakeSecureMessageDelegate : public SecureMessageDelegate { | |
| 17 public: | |
| 18 FakeSecureMessageDelegate(); | |
| 19 ~FakeSecureMessageDelegate() override; | |
| 20 | |
| 21 // SecureMessageDelegate: | |
| 22 void GenerateKeyPair(const GenerateKeyPairCallback& callback) override; | |
| 23 | |
|
Ilya Sherman
2015/04/03 22:43:42
nit: Please remove this newline.
Tim Song
2015/04/04 05:06:14
Done.
| |
| 24 void DeriveKey(const std::string& private_key, | |
| 25 const std::string& public_key, | |
| 26 const DeriveKeyCallback& callback) override; | |
| 27 void CreateSecureMessage( | |
| 28 const std::string& payload, | |
| 29 const std::string& key, | |
| 30 const CreateOptions& create_options, | |
| 31 const CreateSecureMessageCallback& callback) override; | |
| 32 void UnwrapSecureMessage( | |
| 33 const std::string& serialized_message, | |
| 34 const std::string& key, | |
| 35 const UnwrapOptions& unwrap_options, | |
| 36 const UnwrapSecureMessageCallback& callback) override; | |
| 37 | |
| 38 // Sets the next public key to be returned by GenerateKeyPair(). The | |
| 39 // corresponding private key will be derived from this public key. | |
| 40 void set_next_public_key(const std::string& public_key) { | |
| 41 next_public_key_ = public_key; | |
| 42 } | |
| 43 | |
| 44 private: | |
| 45 std::string next_public_key_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(FakeSecureMessageDelegate); | |
| 48 }; | |
| 49 | |
| 50 } // namespace proximity_auth | |
| 51 | |
| 52 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H | |
| OLD | NEW |