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

Unified Diff: base/memory/shared_memory_unittest.cc

Issue 2859843002: Add a GUID to base::SharedMemoryHandle. (Closed)
Patch Set: fix guid on android. Created 3 years, 7 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 2cc7968e784470b78e98061f5cea95f92a583334..98698ecfb31208bb7cc48317401e9c315c8e021c 100644
--- a/base/memory/shared_memory_unittest.cc
+++ b/base/memory/shared_memory_unittest.cc
@@ -19,6 +19,7 @@
#include "base/test/multiprocess_test.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
+#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
@@ -333,6 +334,7 @@ TEST(SharedMemoryTest, GetReadOnlyHandle) {
EXPECT_TRUE(writable_shmem.Unmap());
SharedMemoryHandle readonly_handle = writable_shmem.GetReadOnlyHandle();
+ EXPECT_EQ(writable_shmem.handle().GetGUID(), readonly_handle.GetGUID());
ASSERT_TRUE(readonly_handle.IsValid());
SharedMemory readonly_shmem(readonly_handle, /*readonly=*/true);
@@ -605,7 +607,8 @@ TEST(SharedMemoryTest, UnsafeImageSection) {
EXPECT_EQ(nullptr, shared_memory_open.memory());
SharedMemory shared_memory_handle_local(
- SharedMemoryHandle(section_handle.Take()), true);
+ SharedMemoryHandle(section_handle.Take(), UnguessableToken::Create()),
+ true);
EXPECT_FALSE(shared_memory_handle_local.Map(1));
EXPECT_EQ(nullptr, shared_memory_handle_local.memory());
@@ -620,7 +623,7 @@ TEST(SharedMemoryTest, UnsafeImageSection) {
::GetCurrentProcess(), shared_memory_handle_dummy.handle().GetHandle(),
::GetCurrentProcess(), &handle_no_query, FILE_MAP_READ, FALSE, 0));
SharedMemory shared_memory_handle_no_query(
- SharedMemoryHandle(handle_no_query), true);
+ SharedMemoryHandle(handle_no_query, UnguessableToken::Create()), true);
EXPECT_FALSE(shared_memory_handle_no_query.Map(1));
EXPECT_EQ(nullptr, shared_memory_handle_no_query.memory());
}
« 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