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

Side by Side Diff: base/memory/shared_memory_unittest.cc

Issue 2102923002: Change MessagePumpForGpu and SharedMemory to ScopedHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 ::CreateFileMappingA(file_handle.Get(), nullptr, 585 ::CreateFileMappingA(file_handle.Get(), nullptr,
586 PAGE_READONLY | SEC_IMAGE, 0, 0, kTestSectionName)); 586 PAGE_READONLY | SEC_IMAGE, 0, 0, kTestSectionName));
587 EXPECT_TRUE(section_handle.IsValid()); 587 EXPECT_TRUE(section_handle.IsValid());
588 588
589 // Check direct opening by name, from handle and duplicated from handle. 589 // Check direct opening by name, from handle and duplicated from handle.
590 SharedMemory shared_memory_open; 590 SharedMemory shared_memory_open;
591 EXPECT_TRUE(shared_memory_open.Open(kTestSectionName, true)); 591 EXPECT_TRUE(shared_memory_open.Open(kTestSectionName, true));
592 EXPECT_FALSE(shared_memory_open.Map(1)); 592 EXPECT_FALSE(shared_memory_open.Map(1));
593 EXPECT_EQ(nullptr, shared_memory_open.memory()); 593 EXPECT_EQ(nullptr, shared_memory_open.memory());
594 594
595 SharedMemory shared_memory_handle_dup(
stanisc 2016/06/29 18:36:18 This part of the test is redundant (identical to t
596 SharedMemoryHandle(section_handle.Get(), ::GetCurrentProcessId()), true);
597 EXPECT_FALSE(shared_memory_handle_dup.Map(1));
598 EXPECT_EQ(nullptr, shared_memory_handle_dup.memory());
599
600 SharedMemory shared_memory_handle_local( 595 SharedMemory shared_memory_handle_local(
601 SharedMemoryHandle(section_handle.Take(), ::GetCurrentProcessId()), true); 596 SharedMemoryHandle(section_handle.Take(), ::GetCurrentProcessId()), true);
602 EXPECT_FALSE(shared_memory_handle_local.Map(1)); 597 EXPECT_FALSE(shared_memory_handle_local.Map(1));
603 EXPECT_EQ(nullptr, shared_memory_handle_local.memory()); 598 EXPECT_EQ(nullptr, shared_memory_handle_local.memory());
604 599
605 // Check that a handle without SECTION_QUERY also can't be mapped as it can't 600 // Check that a handle without SECTION_QUERY also can't be mapped as it can't
606 // be checked. 601 // be checked.
607 SharedMemory shared_memory_handle_dummy; 602 SharedMemory shared_memory_handle_dummy;
608 SharedMemoryCreateOptions options; 603 SharedMemoryCreateOptions options;
609 options.size = 0x1000; 604 options.size = 0x1000;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 memory.Close(); 688 memory.Close();
694 SharedMemoryProcessTest::CleanUp(); 689 SharedMemoryProcessTest::CleanUp();
695 } 690 }
696 691
697 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { 692 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) {
698 return SharedMemoryProcessTest::TaskTestMain(); 693 return SharedMemoryProcessTest::TaskTestMain();
699 } 694 }
700 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 695 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
701 696
702 } // namespace base 697 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698