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

Unified Diff: mojo/edk/system/platform_handle_dispatcher_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
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher.cc ('k') | mojo/edk/system/remote_data_pipe_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/platform_handle_dispatcher_unittest.cc
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
index ecc4d3e5cd74cd64c361f54f530242a57c6c435f..7d70d75fe90229397a330fe0711f6f34b7f3a26d 100644
--- a/mojo/edk/system/platform_handle_dispatcher_unittest.cc
+++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -31,8 +31,7 @@ TEST(PlatformHandleDispatcherTest, Basic) {
EXPECT_FALSE(fp);
ASSERT_TRUE(h.is_valid());
- scoped_refptr<PlatformHandleDispatcher> dispatcher =
- PlatformHandleDispatcher::Create(h.Pass());
+ auto dispatcher = PlatformHandleDispatcher::Create(h.Pass());
EXPECT_FALSE(h.is_valid());
EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, dispatcher->GetType());
@@ -64,9 +63,8 @@ TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
util::ScopedFILE fp(test_dir.CreateFile());
EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get()));
- scoped_refptr<PlatformHandleDispatcher> dispatcher =
- PlatformHandleDispatcher::Create(
- mojo::test::PlatformHandleFromFILE(fp.Pass()));
+ auto dispatcher = PlatformHandleDispatcher::Create(
+ mojo::test::PlatformHandleFromFILE(fp.Pass()));
DispatcherTransport transport(
test::DispatcherTryStartTransport(dispatcher.get()));
@@ -74,16 +72,16 @@ TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, transport.GetType());
EXPECT_FALSE(transport.IsBusy());
- scoped_refptr<Dispatcher> generic_dispatcher =
- transport.CreateEquivalentDispatcherAndClose();
+ auto generic_dispatcher = transport.CreateEquivalentDispatcherAndClose();
ASSERT_TRUE(generic_dispatcher);
transport.End();
- EXPECT_TRUE(dispatcher->HasOneRef());
+ dispatcher->AssertHasOneRef();
dispatcher = nullptr;
ASSERT_EQ(Dispatcher::Type::PLATFORM_HANDLE, generic_dispatcher->GetType());
- dispatcher = static_cast<PlatformHandleDispatcher*>(generic_dispatcher.get());
+ dispatcher = RefPtr<PlatformHandleDispatcher>(
+ static_cast<PlatformHandleDispatcher*>(generic_dispatcher.get()));
fp = mojo::test::FILEFromPlatformHandle(dispatcher->PassPlatformHandle(),
"rb").Pass();
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher.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