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

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

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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: mojo/edk/system/remote_data_pipe_impl_unittest.cc
diff --git a/mojo/edk/system/remote_data_pipe_impl_unittest.cc b/mojo/edk/system/remote_data_pipe_impl_unittest.cc
index e669b199c70c8f7f91af1e9b078fb8342397743d..a94ce49dbf6c49771d0dcc0ddd578b723b22df85 100644
--- a/mojo/edk/system/remote_data_pipe_impl_unittest.cc
+++ b/mojo/edk/system/remote_data_pipe_impl_unittest.cc
@@ -174,8 +174,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerWithClosedProducer) {
RefPtr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
// This is the consumer dispatcher we'll send.
- scoped_refptr<DataPipeConsumerDispatcher> consumer =
- DataPipeConsumerDispatcher::Create();
+ auto consumer = DataPipeConsumerDispatcher::Create();
consumer->Init(dp.Clone());
// Write to the producer and close it, before sending the consumer.
@@ -208,7 +207,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerWithClosedProducer) {
// |consumer| should have been closed. This is |DCHECK()|ed when it is
// destroyed.
- EXPECT_TRUE(consumer->HasOneRef());
+ consumer->AssertHasOneRef();
consumer = nullptr;
}
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
@@ -227,12 +226,12 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerWithClosedProducer) {
EXPECT_EQ(1u, read_dispatchers.size());
EXPECT_EQ(1u, read_num_dispatchers);
ASSERT_TRUE(read_dispatchers[0]);
- EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
+ read_dispatchers[0]->AssertHasOneRef();
EXPECT_EQ(Dispatcher::Type::DATA_PIPE_CONSUMER,
read_dispatchers[0]->GetType());
- consumer =
- static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get());
+ consumer = RefPtr<DataPipeConsumerDispatcher>(
+ static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()));
read_dispatchers.clear();
waiter.Init();
@@ -292,8 +291,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringTwoPhaseWrite) {
RefPtr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
// This is the consumer dispatcher we'll send.
- scoped_refptr<DataPipeConsumerDispatcher> consumer =
- DataPipeConsumerDispatcher::Create();
+ auto consumer = DataPipeConsumerDispatcher::Create();
consumer->Init(dp.Clone());
void* write_ptr = nullptr;
@@ -324,7 +322,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringTwoPhaseWrite) {
// |consumer| should have been closed. This is |DCHECK()|ed when it is
// destroyed.
- EXPECT_TRUE(consumer->HasOneRef());
+ consumer->AssertHasOneRef();
consumer = nullptr;
}
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
@@ -343,12 +341,12 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringTwoPhaseWrite) {
EXPECT_EQ(1u, read_dispatchers.size());
EXPECT_EQ(1u, read_num_dispatchers);
ASSERT_TRUE(read_dispatchers[0]);
- EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
+ read_dispatchers[0]->AssertHasOneRef();
EXPECT_EQ(Dispatcher::Type::DATA_PIPE_CONSUMER,
read_dispatchers[0]->GetType());
- consumer =
- static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get());
+ consumer = RefPtr<DataPipeConsumerDispatcher>(
+ static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()));
read_dispatchers.clear();
// Now actually write the data, complete the two-phase write, and close the
@@ -402,8 +400,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringSecondTwoPhaseWrite) {
RefPtr<DataPipe> dp(CreateLocal(sizeof(int32_t), 1000));
// This is the consumer dispatcher we'll send.
- scoped_refptr<DataPipeConsumerDispatcher> consumer =
- DataPipeConsumerDispatcher::Create();
+ auto consumer = DataPipeConsumerDispatcher::Create();
consumer->Init(dp.Clone());
void* write_ptr = nullptr;
@@ -444,7 +441,7 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringSecondTwoPhaseWrite) {
// |consumer| should have been closed. This is |DCHECK()|ed when it is
// destroyed.
- EXPECT_TRUE(consumer->HasOneRef());
+ consumer->AssertHasOneRef();
consumer = nullptr;
}
EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
@@ -463,12 +460,12 @@ TEST_F(RemoteDataPipeImplTest, SendConsumerDuringSecondTwoPhaseWrite) {
EXPECT_EQ(1u, read_dispatchers.size());
EXPECT_EQ(1u, read_num_dispatchers);
ASSERT_TRUE(read_dispatchers[0]);
- EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
+ read_dispatchers[0]->AssertHasOneRef();
EXPECT_EQ(Dispatcher::Type::DATA_PIPE_CONSUMER,
read_dispatchers[0]->GetType());
- consumer =
- static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get());
+ consumer = RefPtr<DataPipeConsumerDispatcher>(
+ static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()));
read_dispatchers.clear();
// Now actually write the data, complete the two-phase write, and close the
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher_unittest.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698