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

Unified Diff: base/memory/shared_memory_unittest.cc

Issue 1163943004: Make SharedMemoryHandle a class on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Remove more unused headers that magically appeared from rebase. Created 5 years, 6 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 7ed8955525ec972392536e3369b0d0657632194b..c129e18d4c3049961ee1462cb93870c2485e594e 100644
--- a/base/memory/shared_memory_unittest.cc
+++ b/base/memory/shared_memory_unittest.cc
@@ -360,12 +360,13 @@ TEST(SharedMemoryTest, ShareReadOnly) {
// http://crbug.com/320865
(void)handle;
#elif defined(OS_POSIX)
- EXPECT_EQ(O_RDONLY, fcntl(handle.fd, F_GETFL) & O_ACCMODE)
+ int handle_fd = SharedMemory::GetFdFromSharedMemoryHandle(handle);
+ EXPECT_EQ(O_RDONLY, fcntl(handle_fd, F_GETFL) & O_ACCMODE)
<< "The descriptor itself should be read-only.";
errno = 0;
- void* writable = mmap(
- NULL, contents.size(), PROT_READ | PROT_WRITE, MAP_SHARED, handle.fd, 0);
+ void* writable = mmap(NULL, contents.size(), PROT_READ | PROT_WRITE,
+ MAP_SHARED, handle_fd, 0);
int mmap_errno = errno;
EXPECT_EQ(MAP_FAILED, writable)
<< "It shouldn't be possible to re-mmap the descriptor writable.";
@@ -519,7 +520,8 @@ TEST(SharedMemoryTest, FilePermissionsAnonymous) {
EXPECT_TRUE(shared_memory.Create(options));
- int shm_fd = shared_memory.handle().fd;
+ int shm_fd =
+ SharedMemory::GetFdFromSharedMemoryHandle(shared_memory.handle());
struct stat shm_stat;
EXPECT_EQ(0, fstat(shm_fd, &shm_stat));
// Neither the group, nor others should be able to read the shared memory
@@ -545,7 +547,8 @@ TEST(SharedMemoryTest, FilePermissionsNamed) {
// Clean-up the backing file name immediately, we don't need it.
EXPECT_TRUE(shared_memory.Delete(shared_mem_name));
- int shm_fd = shared_memory.handle().fd;
+ int shm_fd =
+ SharedMemory::GetFdFromSharedMemoryHandle(shared_memory.handle());
struct stat shm_stat;
EXPECT_EQ(0, fstat(shm_fd, &shm_stat));
// Neither the group, nor others should have been able to open the shared
« 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