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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 runner.RunTest(L"Process_RunApp4 findstr.exe")); | 409 runner.RunTest(L"Process_RunApp4 findstr.exe")); |
410 EXPECT_EQ(SBOX_TEST_SUCCEEDED, | 410 EXPECT_EQ(SBOX_TEST_SUCCEEDED, |
411 runner.RunTest(L"Process_RunApp5 findstr.exe")); | 411 runner.RunTest(L"Process_RunApp5 findstr.exe")); |
412 EXPECT_EQ(SBOX_TEST_SUCCEEDED, | 412 EXPECT_EQ(SBOX_TEST_SUCCEEDED, |
413 runner.RunTest(L"Process_RunApp6 findstr.exe")); | 413 runner.RunTest(L"Process_RunApp6 findstr.exe")); |
414 } | 414 } |
415 | 415 |
416 // Tests that the broker correctly handles a process crashing within the job. | 416 // Tests that the broker correctly handles a process crashing within the job. |
417 TEST(ProcessPolicyTest, CreateProcessCrashy) { | 417 TEST(ProcessPolicyTest, CreateProcessCrashy) { |
418 TestRunner runner; | 418 TestRunner runner; |
419 EXPECT_EQ(STATUS_BREAKPOINT, runner.RunTest(L"Process_Crash")); | 419 EXPECT_EQ(static_cast<int>(STATUS_BREAKPOINT), |
| 420 runner.RunTest(L"Process_Crash")); |
420 } | 421 } |
421 | 422 |
422 TEST(ProcessPolicyTest, OpenToken) { | 423 TEST(ProcessPolicyTest, OpenToken) { |
423 TestRunner runner; | 424 TestRunner runner; |
424 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Process_OpenToken")); | 425 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Process_OpenToken")); |
425 } | 426 } |
426 | 427 |
427 TEST(ProcessPolicyTest, TestGetProcessTokenMinAccess) { | 428 TEST(ProcessPolicyTest, TestGetProcessTokenMinAccess) { |
428 TestRunner runner; | 429 TestRunner runner; |
429 base::string16 exe_path = MakePathToSys(L"findstr.exe", false); | 430 base::string16 exe_path = MakePathToSys(L"findstr.exe", false); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 HANDLE thread = NULL; | 513 HANDLE thread = NULL; |
513 thread = TargetCreateThread( | 514 thread = TargetCreateThread( |
514 ::CreateThread, NULL, 0, &TestThreadFunc, | 515 ::CreateThread, NULL, 0, &TestThreadFunc, |
515 reinterpret_cast<LPVOID>(static_cast<uintptr_t>(pid)), 0, &thread_id); | 516 reinterpret_cast<LPVOID>(static_cast<uintptr_t>(pid)), 0, &thread_id); |
516 EXPECT_NE(static_cast<HANDLE>(NULL), thread); | 517 EXPECT_NE(static_cast<HANDLE>(NULL), thread); |
517 EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(thread, INFINITE)); | 518 EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(thread, INFINITE)); |
518 EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(event, INFINITE)); | 519 EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(event, INFINITE)); |
519 } | 520 } |
520 | 521 |
521 } // namespace sandbox | 522 } // namespace sandbox |
OLD | NEW |