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

Side by Side Diff: mojo/edk/system/message_pipe_test_utils.cc

Issue 1473413002: EDK: Add a TestIOThread::IsCurrentAndRunning(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/edk/system/message_pipe_test_utils.h" 5 #include "mojo/edk/system/message_pipe_test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "mojo/edk/system/channel.h" 10 #include "mojo/edk/system/channel.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 test_io_thread_.PostTaskAndWait(base::Bind( 67 test_io_thread_.PostTaskAndWait(base::Bind(
68 &ChannelThread::ShutdownChannelOnIOThread, base::Unretained(this))); 68 &ChannelThread::ShutdownChannelOnIOThread, base::Unretained(this)));
69 } 69 }
70 test_io_thread_.Stop(); 70 test_io_thread_.Stop();
71 } 71 }
72 72
73 void ChannelThread::InitChannelOnIOThread( 73 void ChannelThread::InitChannelOnIOThread(
74 embedder::ScopedPlatformHandle platform_handle, 74 embedder::ScopedPlatformHandle platform_handle,
75 RefPtr<ChannelEndpoint> channel_endpoint) { 75 RefPtr<ChannelEndpoint> channel_endpoint) {
76 CHECK_EQ(base::MessageLoop::current(), test_io_thread_.message_loop()); 76 CHECK(test_io_thread_.IsCurrentAndRunning());
77 CHECK(platform_handle.is_valid()); 77 CHECK(platform_handle.is_valid());
78 78
79 // Create and initialize |Channel|. 79 // Create and initialize |Channel|.
80 channel_ = MakeRefCounted<Channel>(platform_support_); 80 channel_ = MakeRefCounted<Channel>(platform_support_);
81 channel_->Init(RawChannel::Create(platform_handle.Pass())); 81 channel_->Init(RawChannel::Create(platform_handle.Pass()));
82 82
83 // Start the bootstrap endpoint. 83 // Start the bootstrap endpoint.
84 // Note: On the "server" (parent process) side, we need not attach/run the 84 // Note: On the "server" (parent process) side, we need not attach/run the
85 // endpoint immediately. However, on the "client" (child process) side, this 85 // endpoint immediately. However, on the "client" (child process) side, this
86 // *must* be done here -- otherwise, the |Channel| may receive/process 86 // *must* be done here -- otherwise, the |Channel| may receive/process
(...skipping 17 matching lines...) Expand all
104 } 104 }
105 105
106 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) { 106 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) {
107 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep)); 107 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep));
108 } 108 }
109 #endif 109 #endif
110 110
111 } // namespace test 111 } // namespace test
112 } // namespace system 112 } // namespace system
113 } // namespace mojo 113 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_impl_unittest.cc ('k') | mojo/edk/system/remote_data_pipe_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698