OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ | 5 #ifndef COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ |
6 #define COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ | 6 #define COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/cryptauth/secure_channel.h" | 9 #include "components/cryptauth/secure_channel.h" |
10 | 10 |
11 namespace cryptauth { | 11 namespace cryptauth { |
12 | 12 |
| 13 class CryptAuthService; |
| 14 |
13 // A fake implementation of SecureChannel to use in tests. | 15 // A fake implementation of SecureChannel to use in tests. |
14 class FakeSecureChannel : public SecureChannel { | 16 class FakeSecureChannel : public SecureChannel { |
15 public: | 17 public: |
16 FakeSecureChannel(std::unique_ptr<Connection> connection, | 18 FakeSecureChannel(std::unique_ptr<Connection> connection, |
17 std::unique_ptr<Delegate> delegate); | 19 CryptAuthService* cryptauth_service); |
18 ~FakeSecureChannel() override; | 20 ~FakeSecureChannel() override; |
19 | 21 |
20 struct SentMessage { | 22 struct SentMessage { |
21 SentMessage(const std::string& feature, const std::string& payload); | 23 SentMessage(const std::string& feature, const std::string& payload); |
22 | 24 |
23 std::string feature; | 25 std::string feature; |
24 std::string payload; | 26 std::string payload; |
25 }; | 27 }; |
26 | 28 |
27 void ChangeStatus(const Status& new_status); | 29 void ChangeStatus(const Status& new_status); |
(...skipping 14 matching lines...) Expand all Loading... |
42 private: | 44 private: |
43 std::vector<Observer*> observers_; | 45 std::vector<Observer*> observers_; |
44 std::vector<SentMessage> sent_messages_; | 46 std::vector<SentMessage> sent_messages_; |
45 | 47 |
46 DISALLOW_COPY_AND_ASSIGN(FakeSecureChannel); | 48 DISALLOW_COPY_AND_ASSIGN(FakeSecureChannel); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace cryptauth | 51 } // namespace cryptauth |
50 | 52 |
51 #endif // COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ | 53 #endif // COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_ |
OLD | NEW |