| OLD | NEW |
| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 base::SharedMemory test_shared_memory; | 77 base::SharedMemory test_shared_memory; |
| 78 ASSERT_TRUE(test_shared_memory.CreateAnonymous(1000)); | 78 ASSERT_TRUE(test_shared_memory.CreateAnonymous(1000)); |
| 79 ASSERT_TRUE(test_shared_memory.Map(0)); | 79 ASSERT_TRUE(test_shared_memory.Map(0)); |
| 80 | 80 |
| 81 TestRunner runner; | 81 TestRunner runner; |
| 82 void* shared_handle = runner.GetPolicy()->AddHandleToShare( | 82 void* shared_handle = runner.GetPolicy()->AddHandleToShare( |
| 83 test_shared_memory.handle().GetHandle()); | 83 test_shared_memory.handle().GetHandle()); |
| 84 | 84 |
| 85 std::string command_line = | 85 std::string command_line = "HandleInheritanceTests_ValidInheritedHandle " + |
| 86 "HandleInheritanceTests_ValidInheritedHandle " + | 86 // Cast through uintptr_t and then unsigned int to |
| 87 base::UintToString(reinterpret_cast<unsigned int>(shared_handle)); | 87 // make the truncation explicit. Handles are size |
| 88 // of-pointer but are always 32-bit values. |
| 89 base::UintToString(static_cast<unsigned int>( |
| 90 reinterpret_cast<uintptr_t>(shared_handle))); |
| 88 int result = runner.RunTest(base::UTF8ToUTF16(command_line).c_str()); | 91 int result = runner.RunTest(base::UTF8ToUTF16(command_line).c_str()); |
| 89 ASSERT_EQ(SBOX_TEST_SUCCEEDED, result); | 92 ASSERT_EQ(SBOX_TEST_SUCCEEDED, result); |
| 90 } | 93 } |
| 91 | 94 |
| 92 } // namespace sandbox | 95 } // namespace sandbox |
| OLD | NEW |