| Index: remoting/test/app_remoting_connected_client_fixture.cc
|
| diff --git a/remoting/test/app_remoting_connected_client_fixture.cc b/remoting/test/app_remoting_connected_client_fixture.cc
|
| index adc22d363b89dd69886a1c571ffe02e5f022f6ca..3660fb4b2c6a36d76b42f72b412b5ab3ef3148b0 100644
|
| --- a/remoting/test/app_remoting_connected_client_fixture.cc
|
| +++ b/remoting/test/app_remoting_connected_client_fixture.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "remoting/test/app_remoting_connected_client_fixture.h"
|
|
|
| +#include "base/callback_helpers.h"
|
| #include "base/json/json_reader.h"
|
| #include "base/logging.h"
|
| #include "base/run_loop.h"
|
| @@ -47,7 +48,12 @@ AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() {
|
| void AppRemotingConnectedClientFixture::SetUp() {
|
| connection_helper_.reset(
|
| new AppRemotingConnectionHelper(application_details_));
|
| - connection_helper_->Initialize(make_scoped_ptr(new TestChromotingClient()));
|
| + scoped_ptr<TestChromotingClient> test_chromoting_client(
|
| + new TestChromotingClient());
|
| +
|
| + test_chromoting_client->AddRemoteConnectionObserver(this);
|
| +
|
| + connection_helper_->Initialize(test_chromoting_client.Pass());
|
| if (!connection_helper_->StartConnection()) {
|
| LOG(ERROR) << "Remote host connection could not be established.";
|
| FAIL();
|
| @@ -55,9 +61,20 @@ void AppRemotingConnectedClientFixture::SetUp() {
|
| }
|
|
|
| void AppRemotingConnectedClientFixture::TearDown() {
|
| + connection_helper_->test_chromoting_client()->RemoveRemoteConnectionObserver(
|
| + this);
|
| connection_helper_.reset();
|
| }
|
|
|
| +void AppRemotingConnectedClientFixture::HostMessageReceived(
|
| + const protocol::ExtensionMessage& message) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + if (!host_message_received_callback_.is_null()) {
|
| + host_message_received_callback_.Run(message);
|
| + }
|
| +}
|
| +
|
| bool AppRemotingConnectedClientFixture::VerifyResponseForSimpleHostMessage(
|
| const std::string& message_request_title,
|
| const std::string& message_response_title,
|
| @@ -70,11 +87,9 @@ bool AppRemotingConnectedClientFixture::VerifyResponseForSimpleHostMessage(
|
| DCHECK(!run_loop_ || !run_loop_->running());
|
| run_loop_.reset(new base::RunLoop());
|
|
|
| - HostMessageReceivedCallback host_message_received_callback_ =
|
| + host_message_received_callback_ =
|
| base::Bind(&SimpleHostMessageHandler, message_response_title,
|
| message_payload, run_loop_->QuitClosure(), &message_received);
|
| - connection_helper_->SetHostMessageReceivedCallback(
|
| - host_message_received_callback_);
|
|
|
| protocol::ExtensionMessage message;
|
| message.set_type(message_request_title);
|
| @@ -86,6 +101,7 @@ bool AppRemotingConnectedClientFixture::VerifyResponseForSimpleHostMessage(
|
|
|
| run_loop_->Run();
|
| timer_->Stop();
|
| + host_message_received_callback_.Reset();
|
|
|
| return message_received;
|
| }
|
|
|