Chromium Code Reviews| Index: remoting/test/app_remoting_connected_client_fixture.h |
| diff --git a/remoting/test/app_remoting_connected_client_fixture.h b/remoting/test/app_remoting_connected_client_fixture.h |
| index 213c24fbf4b1d8d68ff7e4330ec64b1239fe7de5..2b40baa5bd7323f9d1a2f14b8cb382452305cfdb 100644 |
| --- a/remoting/test/app_remoting_connected_client_fixture.h |
| +++ b/remoting/test/app_remoting_connected_client_fixture.h |
| @@ -9,6 +9,7 @@ |
| #include "base/callback.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/threading/thread_checker.h" |
| #include "remoting/test/remote_connection_observer.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -23,11 +24,17 @@ namespace test { |
| struct RemoteApplicationDetails; |
| class AppRemotingConnectionHelper; |
| +class TestChromotingClient; |
| + |
| +// Allows for custom handling of ExtensionMessage messages. |
| +typedef base::Callback<void(const protocol::ExtensionMessage& message)> |
| + HostMessageReceivedCallback; |
| // Creates a connection to a remote host which is available for tests to use. |
| // All callbacks must occur on the same thread the object was created on. |
| class AppRemotingConnectedClientFixture |
| - : public testing::TestWithParam<const char*> { |
| + : public testing::TestWithParam<const char*>, |
| + public RemoteConnectionObserver { |
| public: |
| AppRemotingConnectedClientFixture(); |
| ~AppRemotingConnectedClientFixture() override; |
| @@ -46,6 +53,12 @@ class AppRemotingConnectedClientFixture |
| void SetUp() override; |
| void TearDown() override; |
| + // RemoteConnectionObserver interface. |
| + void HostMessageReceived(const protocol::ExtensionMessage& message) override; |
| + |
| + // Handles messages from the host. |
| + void HandleOnHostMessage(const remoting::protocol::ExtensionMessage& message); |
| + |
| // Contains the details for the application being tested. |
| const RemoteApplicationDetails& application_details_; |
| @@ -62,6 +75,13 @@ class AppRemotingConnectedClientFixture |
| // Creates and manages the connection to the remote host. |
| scoped_ptr<AppRemotingConnectionHelper> connection_helper_; |
| + // Using WeakPtr to keep a reference to TestChromotingClient while let the |
| + // AppRemotingConnectionHelper own its lifetime. |
| + base::WeakPtr<TestChromotingClient> test_chromoting_client_; |
|
Sergey Ulanov
2015/07/23 19:36:55
I don't think you really need this to be a weak po
liaoyuke
2015/07/24 02:07:28
Done.
|
| + |
| + // Called when an ExtensionMessage is received from the host. |
| + HostMessageReceivedCallback host_message_received_callback_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AppRemotingConnectedClientFixture); |
| }; |