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

Unified Diff: remoting/host/setup/native_messaging_host.cc

Issue 14979008: unittests for Chromoting native messaging host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename pipe.h->test_util.h, and fix Windows test failure Created 7 years, 7 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/host/setup/native_messaging_host.h ('k') | remoting/host/setup/native_messaging_host_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/native_messaging_host.cc
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc
index 7ce09ea44d8f451defcd78bcf4962f19446298dc..28a0b1063734e168633e529b3cc682fb8a39d211 100644
--- a/remoting/host/setup/native_messaging_host.cc
+++ b/remoting/host/setup/native_messaging_host.cc
@@ -37,6 +37,7 @@ scoped_ptr<base::DictionaryValue> ConfigDictionaryFromMessage(
namespace remoting {
NativeMessagingHost::NativeMessagingHost(
+ scoped_ptr<DaemonController> daemon_controller,
base::PlatformFile input,
base::PlatformFile output,
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
@@ -45,7 +46,7 @@ NativeMessagingHost::NativeMessagingHost(
quit_closure_(quit_closure),
native_messaging_reader_(input),
native_messaging_writer_(output),
- daemon_controller_(DaemonController::Create()),
+ daemon_controller_(daemon_controller.Pass()),
weak_factory_(this) {
weak_ptr_ = weak_factory_.GetWeakPtr();
}
@@ -70,10 +71,16 @@ void NativeMessagingHost::Shutdown() {
void NativeMessagingHost::ProcessMessage(scoped_ptr<base::Value> message) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
+
+ // Don't process any more messages if Shutdown() has been called.
+ if (quit_closure_.is_null())
+ return;
+
const base::DictionaryValue* message_dict;
if (!message->GetAsDictionary(&message_dict)) {
LOG(ERROR) << "Expected DictionaryValue";
Shutdown();
+ return;
}
scoped_ptr<base::DictionaryValue> response_dict(new base::DictionaryValue());
« no previous file with comments | « remoting/host/setup/native_messaging_host.h ('k') | remoting/host/setup/native_messaging_host_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698