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 void GenerateKeyPair(const GenerateKeyPairCallback& callback) override; | |
|
Ilya Sherman
2015/04/03 02:13:05
nit: Add a "// SecureMessageDelegate:" comment abo
Tim Song
2015/04/03 02:46:34
Done.
| |
| 22 | |
| 23 void DeriveKey(const std::string& private_key, | |
| 24 const std::string& public_key, | |
| 25 const DeriveKeyCallback& callback) override; | |
| 26 | |
| 27 void CreateSecureMessage( | |
| 28 const std::string& payload, | |
| 29 const std::string& key, | |
| 30 const CreateOptions& create_options, | |
| 31 const CreateSecureMessageCallback& callback) override; | |
| 32 | |
| 33 void UnwrapSecureMessage( | |
| 34 const std::string& serialized_message, | |
| 35 const std::string& key, | |
| 36 const UnwrapOptions& unwrap_options, | |
| 37 const UnwrapSecureMessageCallback& callback) override; | |
| 38 | |
| 39 // Sets the next public key to be returned by GenerateKeyPair(). The | |
| 40 // corresponding private key will be derived from this public key. | |
| 41 void set_next_public_key(const std::string& public_key) { | |
| 42 next_public_key_ = public_key; | |
| 43 } | |
| 44 | |
| 45 private: | |
| 46 std::string next_public_key_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(FakeSecureMessageDelegate); | |
| 49 }; | |
| 50 | |
|
Ilya Sherman
2015/04/03 02:13:05
I'd prefer not to add this class until it is actua
Tim Song
2015/04/03 02:46:34
Looking at our existing tests, though, it is clear
| |
| 51 } // namespace proximity_auth | |
| 52 | |
| 53 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H | |
| OLD | NEW |