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

Unified Diff: remoting/host/it2me/it2me_native_messaging_host_unittest.cc

Issue 887853002: Shutdown the It2Me host cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@it2me_host_dcheck
Patch Set: Created 5 years, 11 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/host/it2me/it2me_native_messaging_host_unittest.cc
diff --git a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
index d65583cfb52799a892c43dddfb1769c78495c43b..a3f4eb56de82c6697807630a529529817eefab4a 100644
--- a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
@@ -190,7 +190,6 @@ class It2MeNativeMessagingHostTest : public testing::Test {
private:
void StartHost();
- void StopHost();
void ExitTest();
// Each test creates two unidirectional pipes: "input" and "output".
@@ -239,6 +238,10 @@ void It2MeNativeMessagingHostTest::SetUp() {
}
void It2MeNativeMessagingHostTest::TearDown() {
+ // Release reference to AutoThreadTaskRunner, so the host thread can be shut
+ // down.
+ host_task_runner_ = nullptr;
+
// Closing the write-end of the input will send an EOF to the native
// messaging reader. This will trigger a host shutdown.
input_write_file_.Close();
@@ -443,28 +446,13 @@ void It2MeNativeMessagingHostTest::StartHost() {
make_scoped_ptr(new MockIt2MeHostFactory())));
it2me_host->Start(pipe_.get());
- pipe_->Start(it2me_host.Pass(),
- channel.Pass(),
- base::Bind(&It2MeNativeMessagingHostTest::StopHost,
- base::Unretained(this)));
+ pipe_->Start(it2me_host.Pass(), channel.Pass());
// Notify the test that the host has finished starting up.
test_message_loop_->message_loop_proxy()->PostTask(
FROM_HERE, test_run_loop_->QuitClosure());
}
-void It2MeNativeMessagingHostTest::StopHost() {
- DCHECK(host_task_runner_->RunsTasksOnCurrentThread());
-
- pipe_.reset();
-
- // Wait till all shutdown tasks have completed.
- base::RunLoop().RunUntilIdle();
-
- // Trigger a test shutdown via ExitTest().
- host_task_runner_ = nullptr;
-}
-
void It2MeNativeMessagingHostTest::ExitTest() {
if (!test_message_loop_->message_loop_proxy()->RunsTasksOnCurrentThread()) {
test_message_loop_->message_loop_proxy()->PostTask(
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host_main.cc ('k') | remoting/host/native_messaging/native_messaging_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698