Index: base/memory/shared_memory_unittest.cc |
diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc |
index b8999f6f3c59832811c9e5924d82f1cece638b5b..f2a9e7480fc43c7fad8f7e5bed3e5f6d285c3e97 100644 |
--- a/base/memory/shared_memory_unittest.cc |
+++ b/base/memory/shared_memory_unittest.cc |
@@ -477,7 +477,6 @@ TEST(SharedMemoryTest, MapAt) { |
SharedMemory memory; |
ASSERT_TRUE(memory.CreateAndMapAnonymous(kDataSize)); |
- ASSERT_TRUE(memory.Map(kDataSize)); |
uint32* ptr = static_cast<uint32*>(memory.memory()); |
ASSERT_NE(ptr, static_cast<void*>(NULL)); |
@@ -497,6 +496,19 @@ TEST(SharedMemoryTest, MapAt) { |
} |
} |
+TEST(SharedMemoryTest, MapTwice) { |
+ const uint32 kDataSize = 1024; |
+ SharedMemory memory; |
+ bool rv = memory.CreateAndMapAnonymous(kDataSize); |
+ EXPECT_TRUE(rv); |
+ |
+ void* old_address = memory.memory(); |
+ |
+ rv = memory.Map(kDataSize); |
+ EXPECT_FALSE(rv); |
+ EXPECT_EQ(old_address, memory.memory()); |
+} |
+ |
#if defined(OS_POSIX) |
// Create a shared memory object, mmap it, and mprotect it to PROT_EXEC. |
TEST(SharedMemoryTest, AnonymousExecutable) { |