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