Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: remoting/test/app_remoting_connected_client_fixture.cc

Issue 1253613002: Updated latency fixture and refactored connection helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Changed cstdint to stdint.h to compile on mac" Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« no previous file with comments | « remoting/test/app_remoting_connected_client_fixture.h ('k') | remoting/test/app_remoting_connection_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698