OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "base/win/scoped_handle.h" | 6 #include "base/win/scoped_handle.h" |
7 #include "sandbox/win/src/handle_closer_agent.h" | 7 #include "sandbox/win/src/handle_closer_agent.h" |
8 #include "sandbox/win/src/sandbox.h" | 8 #include "sandbox/win/src/sandbox.h" |
9 #include "sandbox/win/src/sandbox_factory.h" | 9 #include "sandbox/win/src/sandbox_factory.h" |
10 #include "sandbox/win/src/target_services.h" | 10 #include "sandbox/win/src/target_services.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 break; | 101 break; |
102 } | 102 } |
103 | 103 |
104 return SBOX_TEST_SUCCEEDED; | 104 return SBOX_TEST_SUCCEEDED; |
105 } | 105 } |
106 | 106 |
107 TEST(HandleCloserTest, CheckForMarkerFiles) { | 107 TEST(HandleCloserTest, CheckForMarkerFiles) { |
108 TestRunner runner; | 108 TestRunner runner; |
109 runner.SetTimeout(2000); | 109 runner.SetTimeout(2000); |
110 runner.SetTestState(EVERY_STATE); | 110 runner.SetTestState(EVERY_STATE); |
111 sandbox::TargetPolicy* policy = runner.GetPolicy(); | |
112 | 111 |
113 base::string16 command = base::string16(L"CheckForFileHandles Y"); | 112 base::string16 command = base::string16(L"CheckForFileHandles Y"); |
114 for (int i = 0; i < arraysize(kFileExtensions); ++i) { | 113 for (int i = 0; i < arraysize(kFileExtensions); ++i) { |
115 base::string16 handle_name; | 114 base::string16 handle_name; |
116 base::win::ScopedHandle marker(GetMarkerFile(kFileExtensions[i])); | 115 base::win::ScopedHandle marker(GetMarkerFile(kFileExtensions[i])); |
117 CHECK(marker.IsValid()); | 116 CHECK(marker.IsValid()); |
118 CHECK(sandbox::GetHandleName(marker.Get(), &handle_name)); | 117 CHECK(sandbox::GetHandleName(marker.Get(), &handle_name)); |
119 command += (L" "); | 118 command += (L" "); |
120 command += handle_name; | 119 command += handle_name; |
121 } | 120 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 runner.SetTestState(AFTER_REVERT); | 185 runner.SetTestState(AFTER_REVERT); |
187 sandbox::TargetPolicy* policy = runner.GetPolicy(); | 186 sandbox::TargetPolicy* policy = runner.GetPolicy(); |
188 | 187 |
189 // Sever the CSRSS connection by closing ALPC ports inside the sandbox. | 188 // Sever the CSRSS connection by closing ALPC ports inside the sandbox. |
190 CHECK_EQ(policy->AddKernelObjectToClose(L"ALPC Port", NULL), SBOX_ALL_OK); | 189 CHECK_EQ(policy->AddKernelObjectToClose(L"ALPC Port", NULL), SBOX_ALL_OK); |
191 | 190 |
192 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"RunThreadPool")); | 191 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"RunThreadPool")); |
193 } | 192 } |
194 | 193 |
195 } // namespace sandbox | 194 } // namespace sandbox |
OLD | NEW |