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

Unified Diff: base/memory/shared_memory_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_posix.cc ('k') | base/memory/shared_memory_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_unittest.cc
diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc
index 2da99e817d880cfde7d91cc2cc4b7c4229a8c98d..2bae0e9d1a2cf01103889b650d926a59dceb5d38 100644
--- a/base/memory/shared_memory_unittest.cc
+++ b/base/memory/shared_memory_unittest.cc
@@ -316,7 +316,7 @@ TEST(SharedMemoryTest, AnonymousPrivate) {
}
}
-TEST(SharedMemoryTest, ShareReadOnly) {
+TEST(SharedMemoryTest, GetReadOnlyHandle) {
StringPiece contents = "Hello World";
SharedMemory writable_shmem;
@@ -332,9 +332,8 @@ TEST(SharedMemoryTest, ShareReadOnly) {
memcpy(writable_shmem.memory(), contents.data(), contents.size());
EXPECT_TRUE(writable_shmem.Unmap());
- SharedMemoryHandle readonly_handle;
- ASSERT_TRUE(writable_shmem.ShareReadOnlyToProcess(GetCurrentProcessHandle(),
- &readonly_handle));
+ SharedMemoryHandle readonly_handle = writable_shmem.GetReadOnlyHandle();
+ ASSERT_TRUE(readonly_handle.IsValid());
SharedMemory readonly_shmem(readonly_handle, /*readonly=*/true);
ASSERT_TRUE(readonly_shmem.Map(contents.size()));
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/memory/shared_memory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698