| 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 CC_TEST_REMOTE_PROTO_CHANNEL_BRIDGE_H_ | |
| 6 #define CC_TEST_REMOTE_PROTO_CHANNEL_BRIDGE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "cc/test/test_hooks.h" | |
| 10 #include "cc/trees/remote_proto_channel.h" | |
| 11 | |
| 12 // The RemoteProtoChannelBridge mocks out the external network layer for the | |
| 13 // unit tests by sending messages directly between the RemoteProtoChannels for | |
| 14 // the server and client LayerTreeHost. | |
| 15 namespace cc { | |
| 16 class RemoteProtoChannelBridge; | |
| 17 | |
| 18 class FakeRemoteProtoChannel : public RemoteProtoChannel { | |
| 19 public: | |
| 20 explicit FakeRemoteProtoChannel(RemoteProtoChannelBridge* bridge); | |
| 21 ~FakeRemoteProtoChannel() override; | |
| 22 | |
| 23 // RemoteProtoChannel implementation | |
| 24 void SetProtoReceiver(ProtoReceiver* receiver) override; | |
| 25 | |
| 26 virtual void OnProtoReceived(std::unique_ptr<proto::CompositorMessage> proto); | |
| 27 | |
| 28 bool HasReceiver() const; | |
| 29 | |
| 30 protected: | |
| 31 RemoteProtoChannelBridge* bridge_; | |
| 32 | |
| 33 private: | |
| 34 RemoteProtoChannel::ProtoReceiver* receiver_; | |
| 35 }; | |
| 36 | |
| 37 class FakeRemoteProtoChannelMain : public FakeRemoteProtoChannel { | |
| 38 public: | |
| 39 explicit FakeRemoteProtoChannelMain(RemoteProtoChannelBridge* bridge); | |
| 40 | |
| 41 void SendCompositorProto(const proto::CompositorMessage& proto) override; | |
| 42 }; | |
| 43 | |
| 44 class FakeRemoteProtoChannelImpl : public FakeRemoteProtoChannel { | |
| 45 public: | |
| 46 explicit FakeRemoteProtoChannelImpl(RemoteProtoChannelBridge* bridge); | |
| 47 | |
| 48 void SendCompositorProto(const proto::CompositorMessage& proto) override; | |
| 49 }; | |
| 50 | |
| 51 class RemoteProtoChannelBridge { | |
| 52 public: | |
| 53 RemoteProtoChannelBridge(); | |
| 54 ~RemoteProtoChannelBridge(); | |
| 55 | |
| 56 FakeRemoteProtoChannelMain channel_main; | |
| 57 FakeRemoteProtoChannelImpl channel_impl; | |
| 58 }; | |
| 59 | |
| 60 } // namespace cc | |
| 61 | |
| 62 #endif // CC_TEST_REMOTE_PROTO_CHANNEL_BRIDGE_H_ | |
| OLD | NEW |