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

Unified Diff: base/memory/shared_memory_mac_unittest.cc

Issue 2845113005: Replace base::SharedMemory read-only methods with GetReadOnlyHandle. (Closed)
Patch Set: Comments from thakis. Created 3 years, 8 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 | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_nacl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_mac_unittest.cc
diff --git a/base/memory/shared_memory_mac_unittest.cc b/base/memory/shared_memory_mac_unittest.cc
index 4ccee89deb46ff7aa56ce0057caaa69135c11329..f5d239ff8201503eb264bc52552780078767ebe1 100644
--- a/base/memory/shared_memory_mac_unittest.cc
+++ b/base/memory/shared_memory_mac_unittest.cc
@@ -394,7 +394,7 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcess) {
EXPECT_EQ(active_name_count, GetActiveNameCount());
}
-// Tests that the method ShareReadOnlyToProcess() creates a memory object that
+// Tests that the method GetReadOnlyHandle() creates a memory object that
// is read only.
TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonly) {
std::unique_ptr<SharedMemory> shared_memory(
@@ -409,8 +409,7 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonly) {
ASSERT_EQ(VM_PROT_READ | VM_PROT_WRITE, max_prot);
// Make a new memory object.
- SharedMemoryHandle shm2;
- ASSERT_TRUE(shared_memory->ShareReadOnlyToProcess(GetCurrentProcId(), &shm2));
+ SharedMemoryHandle shm2 = shared_memory->GetReadOnlyHandle();
ASSERT_TRUE(shm2.IsValid());
// Mapping with |readonly| set to |false| should fail.
@@ -435,7 +434,7 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonly) {
ASSERT_DEATH(memset(shared_memory2.memory(), 'b', s_memory_size), "");
}
-// Tests that the method ShareReadOnlyToProcess() doesn't leak.
+// Tests that the method GetReadOnlyHandle() doesn't leak.
TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonlyLeak) {
mach_msg_type_number_t active_name_count = GetActiveNameCount();
@@ -443,9 +442,7 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonlyLeak) {
std::unique_ptr<SharedMemory> shared_memory(
CreateSharedMemory(s_memory_size));
- SharedMemoryHandle shm2;
- ASSERT_TRUE(
- shared_memory->ShareReadOnlyToProcess(GetCurrentProcId(), &shm2));
+ SharedMemoryHandle shm2 = shared_memory->GetReadOnlyHandle();
ASSERT_TRUE(shm2.IsValid());
// Intentionally map with |readonly| set to |false|.
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698