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

Side by Side Diff: components/cryptauth/fake_secure_channel.h

Issue 2697763002: [CrOS Tether]: Create BleConnectionManager, which manages secure connections between the current de… (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
6 #define COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
7
8 #include "base/macros.h"
9 #include "components/cryptauth/secure_channel.h"
10
11 namespace cryptauth {
12
13 // A fake implementation of SecureChannel to use in tests.
14 class FakeSecureChannel : public SecureChannel {
15 public:
16 FakeSecureChannel(std::unique_ptr<Connection> connection,
17 std::unique_ptr<Delegate> delegate);
18 ~FakeSecureChannel() override;
19
20 struct SentMessage {
21 SentMessage(const std::string& feature, const std::string& payload);
22
23 std::string feature;
24 std::string payload;
25 };
26
27 void ChangeStatus(const Status& new_status);
28 void ReceiveMessage(const std::string& feature, const std::string& payload);
29
30 std::vector<Observer*> observers() {
31 return observers_;
32 }
33
34 std::vector<SentMessage> sent_messages() {
35 return sent_messages_;
36 }
37
38 // SecureChannel:
39 void Initialize() override;
40 void SendMessage(const std::string& feature, const std::string& payload)
41 override;
42 void Disconnect() override;
43 void AddObserver(Observer* observer) override;
44 void RemoveObserver(Observer* observer) override;
45
46 private:
47 std::vector<Observer*> observers_;
48 std::vector<SentMessage> sent_messages_;
49
50 DISALLOW_COPY_AND_ASSIGN(FakeSecureChannel);
51 };
52
53 } // namespace cryptauth
54
55 #endif // COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698