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

Unified Diff: base/memory/shared_memory_unittest.cc

Issue 2845113005: Replace base::SharedMemory read-only methods with GetReadOnlyHandle. (Closed)
Patch Set: Rebase. 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
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()));

Powered by Google App Engine
This is Rietveld 408576698