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

Unified Diff: remoting/test/app_remoting_connection_helper.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
« no previous file with comments | « remoting/test/app_remoting_connection_helper.h ('k') | remoting/test/app_remoting_latency_test_fixture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/app_remoting_connection_helper.cc
diff --git a/remoting/test/app_remoting_connection_helper.cc b/remoting/test/app_remoting_connection_helper.cc
index 38b86f72271621b3b6a0169f14bb69a40927cdf2..f39b398c9b05a70dbaa281c2cf002caef710733d 100644
--- a/remoting/test/app_remoting_connection_helper.cc
+++ b/remoting/test/app_remoting_connection_helper.cc
@@ -4,7 +4,6 @@
#include "remoting/test/app_remoting_connection_helper.h"
-#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/run_loop.h"
@@ -37,7 +36,9 @@ AppRemotingConnectionHelper::AppRemotingConnectionHelper(
AppRemotingConnectionHelper::~AppRemotingConnectionHelper() {
// |client_| destroys some of its members via DeleteSoon on the message loop's
// TaskRunner so we need to run the loop until it has no more work to do.
- client_->RemoveRemoteConnectionObserver(this);
+ if (!connection_is_ready_for_tests_) {
+ client_->RemoveRemoteConnectionObserver(this);
+ }
client_.reset();
base::RunLoop().RunUntilIdle();
@@ -49,11 +50,6 @@ void AppRemotingConnectionHelper::Initialize(
client_->AddRemoteConnectionObserver(this);
}
-void AppRemotingConnectionHelper::SetHostMessageReceivedCallback(
- HostMessageReceivedCallback host_message_received_callback) {
- host_message_received_callback_ = host_message_received_callback;
-}
-
bool AppRemotingConnectionHelper::StartConnection() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(client_);
@@ -145,11 +141,7 @@ void AppRemotingConnectionHelper::HostMessageReceived(
VLOG(2) << "HostMessage received by HostMessageReceived()."
<< " type: " << message.type() << " data: " << message.data();
- // If a callback is not registered, then the message is passed to a default
- // handler for the class based on the message type.
- if (!host_message_received_callback_.is_null()) {
- base::ResetAndReturn(&host_message_received_callback_).Run(message);
- } else if (message.type() == "onWindowAdded") {
+ if (message.type() == "onWindowAdded") {
HandleOnWindowAddedMessage(message);
} else {
VLOG(2) << "HostMessage not handled by HostMessageReceived().";
@@ -209,6 +201,7 @@ void AppRemotingConnectionHelper::HandleOnWindowAddedMessage(
std::string main_window_title = application_details_.main_window_title;
if (current_window_title.find_first_of(main_window_title) == 0) {
connection_is_ready_for_tests_ = true;
+ client_->RemoveRemoteConnectionObserver(this);
if (timer_->IsRunning()) {
timer_->Stop();
« no previous file with comments | « remoting/test/app_remoting_connection_helper.h ('k') | remoting/test/app_remoting_latency_test_fixture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698