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

Side by Side Diff: base/metrics/persistent_memory_allocator_unittest.cc

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/persistent_memory_allocator.h" 5 #include "base/metrics/persistent_memory_allocator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 r123 = local.Allocate(123, 123); 613 r123 = local.Allocate(123, 123);
614 r456 = local.Allocate(456, 456); 614 r456 = local.Allocate(456, 456);
615 r789 = local.Allocate(789, 789); 615 r789 = local.Allocate(789, 789);
616 local.MakeIterable(r123); 616 local.MakeIterable(r123);
617 local.ChangeType(r456, 654, 456, false); 617 local.ChangeType(r456, 654, 456, false);
618 local.MakeIterable(r789); 618 local.MakeIterable(r789);
619 local.GetMemoryInfo(&meminfo1); 619 local.GetMemoryInfo(&meminfo1);
620 EXPECT_FALSE(local.IsFull()); 620 EXPECT_FALSE(local.IsFull());
621 EXPECT_FALSE(local.IsCorrupt()); 621 EXPECT_FALSE(local.IsCorrupt());
622 622
623 ASSERT_TRUE(local.shared_memory()->ShareToProcess(GetCurrentProcessHandle(), 623 shared_handle_1 = local.shared_memory()->handle().Duplicate();
624 &shared_handle_1)); 624 ASSERT_TRUE(shared_handle_1.IsValid());
625 ASSERT_TRUE(local.shared_memory()->ShareToProcess(GetCurrentProcessHandle(), 625 shared_handle_2 = local.shared_memory()->handle().Duplicate();
626 &shared_handle_2)); 626 ASSERT_TRUE(shared_handle_2.IsValid());
627 } 627 }
628 628
629 // Read-only test. 629 // Read-only test.
630 std::unique_ptr<SharedMemory> shmem2(new SharedMemory(shared_handle_1, 630 std::unique_ptr<SharedMemory> shmem2(new SharedMemory(shared_handle_1,
631 /*readonly=*/true)); 631 /*readonly=*/true));
632 ASSERT_TRUE(shmem2->Map(TEST_MEMORY_SIZE)); 632 ASSERT_TRUE(shmem2->Map(TEST_MEMORY_SIZE));
633 633
634 SharedPersistentMemoryAllocator shalloc2(std::move(shmem2), 0, "", true); 634 SharedPersistentMemoryAllocator shalloc2(std::move(shmem2), 0, "", true);
635 EXPECT_TRUE(shalloc2.IsReadonly()); 635 EXPECT_TRUE(shalloc2.IsReadonly());
636 EXPECT_EQ(TEST_ID, shalloc2.Id()); 636 EXPECT_EQ(TEST_ID, shalloc2.Id());
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 // For filesize >= minsize, the file must be acceptable. This 910 // For filesize >= minsize, the file must be acceptable. This
911 // else clause (file-not-acceptable) should be reached only if 911 // else clause (file-not-acceptable) should be reached only if
912 // filesize < minsize. 912 // filesize < minsize.
913 EXPECT_GT(minsize, filesize); 913 EXPECT_GT(minsize, filesize);
914 } 914 }
915 } 915 }
916 } 916 }
917 #endif // !defined(OS_NACL) 917 #endif // !defined(OS_NACL)
918 918
919 } // namespace base 919 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_win.cc ('k') | chrome/renderer/pepper/pepper_shared_memory_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698