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

Unified Diff: mojo/edk/system/ipc_support_unittest.cc

Issue 1496663002: EDK: Make mojo::platform::TaskRunner's PostTask() take an std::function<void()>. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/endpoint_relayer_unittest.cc ('k') | mojo/edk/system/message_pipe_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/ipc_support_unittest.cc
diff --git a/mojo/edk/system/ipc_support_unittest.cc b/mojo/edk/system/ipc_support_unittest.cc
index af986e9111fd6aadb372340747640ad1648f6de5..ba2818ead87a7a16a14e013d244f34c73d69ad31 100644
--- a/mojo/edk/system/ipc_support_unittest.cc
+++ b/mojo/edk/system/ipc_support_unittest.cc
@@ -195,10 +195,10 @@ class TestSlaveConnection {
// Since |event_| is manual-reset, calling this multiple times is OK.
WaitForChannelToSlave();
- test_io_thread_->PostTaskAndWait(
- base::Bind(&ChannelManager::ShutdownChannelOnIOThread,
- base::Unretained(master_ipc_support_->channel_manager()),
- slave_id_));
+ test_io_thread_->PostTaskAndWait([this]() {
+ master_ipc_support_->channel_manager()->ShutdownChannelOnIOThread(
+ slave_id_);
+ });
}
ScopedPlatformHandle PassSlavePlatformHandle() {
@@ -259,17 +259,16 @@ class TestSlave {
// Since |event_| is manual-reset, calling this multiple times is OK.
WaitForChannelToMaster();
- test_io_thread_->PostTaskAndWait(
- base::Bind(&ChannelManager::ShutdownChannelOnIOThread,
- base::Unretained(slave_ipc_support_.channel_manager()),
- kMasterProcessIdentifier));
+ test_io_thread_->PostTaskAndWait([this]() {
+ slave_ipc_support_.channel_manager()->ShutdownChannelOnIOThread(
+ kMasterProcessIdentifier);
+ });
}
// No other methods may be called after this.
void ShutdownIPCSupport() {
test_io_thread_->PostTaskAndWait(
- base::Bind(&IPCSupport::ShutdownOnIOThread,
- base::Unretained(&slave_ipc_support_)));
+ [this]() { slave_ipc_support_.ShutdownOnIOThread(); });
}
private:
@@ -387,8 +386,7 @@ class IPCSupportTest : public testing::Test {
void ShutdownMasterIPCSupport() {
test_io_thread_.PostTaskAndWait(
- base::Bind(&IPCSupport::ShutdownOnIOThread,
- base::Unretained(&master_ipc_support_)));
+ [this]() { master_ipc_support_.ShutdownOnIOThread(); });
}
embedder::SimplePlatformSupport& platform_support() {
@@ -614,8 +612,8 @@ TEST_F(IPCSupportTest, MasterSlaveInternal) {
EXPECT_EQ(1u, n);
EXPECT_EQ('x', c);
- test_io_thread().PostTaskAndWait(base::Bind(
- &IPCSupport::ShutdownOnIOThread, base::Unretained(&slave_ipc_support)));
+ test_io_thread().PostTaskAndWait(
+ [&slave_ipc_support]() { slave_ipc_support.ShutdownOnIOThread(); });
EXPECT_TRUE(master_process_delegate().TryWaitForOnSlaveDisconnect());
@@ -708,8 +706,8 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlaveInternal) {
mojo::test::BlockingWrite(second_platform_handle.get(), "!", 1, &n));
EXPECT_EQ(1u, n);
- test_io_thread.PostTaskAndWait(base::Bind(&IPCSupport::ShutdownOnIOThread,
- base::Unretained(&ipc_support)));
+ test_io_thread.PostTaskAndWait(
+ [&ipc_support]() { ipc_support.ShutdownOnIOThread(); });
}
// TODO(vtl): Also test the case of the master "dying" before the slave. (The
« no previous file with comments | « mojo/edk/system/endpoint_relayer_unittest.cc ('k') | mojo/edk/system/message_pipe_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698