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

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

Issue 1350183002: EDK: More scoped_ptr -> std::unique_ptr conversions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: gah Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/system/raw_channel_unittest.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 // We'll try to pass this dispatcher. 906 // We'll try to pass this dispatcher.
907 scoped_refptr<SharedBufferDispatcher> dispatcher; 907 scoped_refptr<SharedBufferDispatcher> dispatcher;
908 EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create( 908 EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
909 platform_support(), 909 platform_support(),
910 SharedBufferDispatcher::kDefaultCreateOptions, 910 SharedBufferDispatcher::kDefaultCreateOptions,
911 100, &dispatcher)); 911 100, &dispatcher));
912 ASSERT_TRUE(dispatcher); 912 ASSERT_TRUE(dispatcher);
913 913
914 // Make a mapping. 914 // Make a mapping.
915 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping0; 915 std::unique_ptr<embedder::PlatformSharedBufferMapping> mapping0;
916 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer( 916 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
917 0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping0)); 917 0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping0));
918 ASSERT_TRUE(mapping0); 918 ASSERT_TRUE(mapping0);
919 ASSERT_TRUE(mapping0->GetBase()); 919 ASSERT_TRUE(mapping0->GetBase());
920 ASSERT_EQ(100u, mapping0->GetLength()); 920 ASSERT_EQ(100u, mapping0->GetLength());
921 static_cast<char*>(mapping0->GetBase())[0] = 'A'; 921 static_cast<char*>(mapping0->GetBase())[0] = 'A';
922 static_cast<char*>(mapping0->GetBase())[50] = 'B'; 922 static_cast<char*>(mapping0->GetBase())[50] = 'B';
923 static_cast<char*>(mapping0->GetBase())[99] = 'C'; 923 static_cast<char*>(mapping0->GetBase())[99] = 'C';
924 924
925 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do 925 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 EXPECT_STREQ(kHello, read_buffer); 972 EXPECT_STREQ(kHello, read_buffer);
973 EXPECT_EQ(1u, read_dispatchers.size()); 973 EXPECT_EQ(1u, read_dispatchers.size());
974 EXPECT_EQ(1u, read_num_dispatchers); 974 EXPECT_EQ(1u, read_num_dispatchers);
975 ASSERT_TRUE(read_dispatchers[0]); 975 ASSERT_TRUE(read_dispatchers[0]);
976 EXPECT_TRUE(read_dispatchers[0]->HasOneRef()); 976 EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
977 977
978 EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, read_dispatchers[0]->GetType()); 978 EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, read_dispatchers[0]->GetType());
979 dispatcher = static_cast<SharedBufferDispatcher*>(read_dispatchers[0].get()); 979 dispatcher = static_cast<SharedBufferDispatcher*>(read_dispatchers[0].get());
980 980
981 // Make another mapping. 981 // Make another mapping.
982 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping1; 982 std::unique_ptr<embedder::PlatformSharedBufferMapping> mapping1;
983 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer( 983 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
984 0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping1)); 984 0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping1));
985 ASSERT_TRUE(mapping1); 985 ASSERT_TRUE(mapping1);
986 ASSERT_TRUE(mapping1->GetBase()); 986 ASSERT_TRUE(mapping1->GetBase());
987 ASSERT_EQ(100u, mapping1->GetLength()); 987 ASSERT_EQ(100u, mapping1->GetLength());
988 EXPECT_NE(mapping1->GetBase(), mapping0->GetBase()); 988 EXPECT_NE(mapping1->GetBase(), mapping0->GetBase());
989 EXPECT_EQ('A', static_cast<char*>(mapping1->GetBase())[0]); 989 EXPECT_EQ('A', static_cast<char*>(mapping1->GetBase())[0]);
990 EXPECT_EQ('B', static_cast<char*>(mapping1->GetBase())[50]); 990 EXPECT_EQ('B', static_cast<char*>(mapping1->GetBase())[50]);
991 EXPECT_EQ('C', static_cast<char*>(mapping1->GetBase())[99]); 991 EXPECT_EQ('C', static_cast<char*>(mapping1->GetBase())[99]);
992 992
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 mp0->Close(0); 1352 mp0->Close(0);
1353 mp1->Close(1); 1353 mp1->Close(1);
1354 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); 1354 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
1355 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed. 1355 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed.
1356 local_mp->Close(1); 1356 local_mp->Close(1);
1357 } 1357 }
1358 1358
1359 } // namespace 1359 } // namespace
1360 } // namespace system 1360 } // namespace system
1361 } // namespace mojo 1361 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel_unittest.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698