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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
| 13 #include "base/win/win_util.h" |
13 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
14 #include "sandbox/win/tests/common/controller.h" | 15 #include "sandbox/win/tests/common/controller.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace sandbox { | 18 namespace sandbox { |
18 | 19 |
19 SBOX_TESTS_COMMAND int HandleInheritanceTests_PrintToStdout(int argc, | 20 SBOX_TESTS_COMMAND int HandleInheritanceTests_PrintToStdout(int argc, |
20 wchar_t** argv) { | 21 wchar_t** argv) { |
21 printf("Example output to stdout\n"); | 22 printf("Example output to stdout\n"); |
22 return SBOX_TEST_SUCCEEDED; | 23 return SBOX_TEST_SUCCEEDED; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 base::SharedMemory test_shared_memory; | 78 base::SharedMemory test_shared_memory; |
78 ASSERT_TRUE(test_shared_memory.CreateAnonymous(1000)); | 79 ASSERT_TRUE(test_shared_memory.CreateAnonymous(1000)); |
79 ASSERT_TRUE(test_shared_memory.Map(0)); | 80 ASSERT_TRUE(test_shared_memory.Map(0)); |
80 | 81 |
81 TestRunner runner; | 82 TestRunner runner; |
82 void* shared_handle = runner.GetPolicy()->AddHandleToShare( | 83 void* shared_handle = runner.GetPolicy()->AddHandleToShare( |
83 test_shared_memory.handle().GetHandle()); | 84 test_shared_memory.handle().GetHandle()); |
84 | 85 |
85 std::string command_line = | 86 std::string command_line = |
86 "HandleInheritanceTests_ValidInheritedHandle " + | 87 "HandleInheritanceTests_ValidInheritedHandle " + |
87 base::UintToString(reinterpret_cast<unsigned int>(shared_handle)); | 88 base::UintToString(base::win::HandleToUint32(shared_handle)); |
88 int result = runner.RunTest(base::UTF8ToUTF16(command_line).c_str()); | 89 int result = runner.RunTest(base::UTF8ToUTF16(command_line).c_str()); |
89 ASSERT_EQ(SBOX_TEST_SUCCEEDED, result); | 90 ASSERT_EQ(SBOX_TEST_SUCCEEDED, result); |
90 } | 91 } |
91 | 92 |
92 } // namespace sandbox | 93 } // namespace sandbox |
OLD | NEW |