OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 BLIMP_NET_FAKE_PIPE_MANAGER_H_ | |
6 #define BLIMP_NET_FAKE_PIPE_MANAGER_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "blimp/net/fake_blimp_message_processor.h" | |
11 #include "blimp/net/pipe_manager.h" | |
12 | |
13 namespace blimp { | |
14 | |
15 // Stores outgoing messages in memory, and allows incoming messages to be | |
16 // faked. | |
17 class BLIMP_NET_EXPORT FakePipeManager : public PipeManager { | |
18 public: | |
19 FakePipeManager(); | |
20 ~FakePipeManager() override; | |
21 | |
22 std::unique_ptr<BlimpMessageProcessor> RegisterFeature( | |
23 BlimpMessage::FeatureCase feature_case, | |
24 BlimpMessageProcessor* incoming_processor) override; | |
25 | |
26 // Send a fake incoming message as though it arrived from the network. | |
27 void SendIncomingMessage(std::unique_ptr<BlimpMessage>); | |
28 | |
29 // Access the outgoing message processor for a given feature in order to | |
30 // inspect sent messages. | |
31 FakeBlimpMessageProcessor* GetOutgoingMessageProcessor( | |
32 BlimpMessage::FeatureCase feature_case); | |
33 | |
34 private: | |
35 std::map<BlimpMessage::FeatureCase, FakeBlimpMessageProcessor*> | |
36 outgoing_processors_; | |
37 | |
38 std::map<BlimpMessage::FeatureCase, BlimpMessageProcessor*> | |
39 incoming_processors_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(FakePipeManager); | |
42 }; | |
43 | |
44 } // namespace blimp | |
45 | |
46 #endif // BLIMP_NET_FAKE_PIPE_MANAGER_H_ | |
OLD | NEW |