| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 // This file contains the validation tests for the sandbox. | 5 // This file contains the validation tests for the sandbox. |
| 6 // It includes the tests that need to be performed inside the | 6 // It includes the tests that need to be performed inside the |
| 7 // sandbox. | 7 // sandbox. |
| 8 | 8 |
| 9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 10 | 10 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 wsprintf(command, L"ValidWindow %d", ::FindWindow(NULL, NULL)); | 93 wsprintf(command, L"ValidWindow %d", ::FindWindow(NULL, NULL)); |
| 94 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); | 94 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Tests if the processes are correctly protected by the sandbox. | 97 // Tests if the processes are correctly protected by the sandbox. |
| 98 TEST(ValidationSuite, TestProcess) { | 98 TEST(ValidationSuite, TestProcess) { |
| 99 TestRunner runner; | 99 TestRunner runner; |
| 100 wchar_t command[1024] = {0}; | 100 wchar_t command[1024] = {0}; |
| 101 | 101 |
| 102 wsprintf(command, L"OpenProcess %d", ::GetCurrentProcessId()); | 102 wsprintf(command, L"OpenProcessCmd %d", ::GetCurrentProcessId()); |
| 103 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); | 103 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Tests if the threads are correctly protected by the sandbox. | 106 // Tests if the threads are correctly protected by the sandbox. |
| 107 TEST(ValidationSuite, TestThread) { | 107 TEST(ValidationSuite, TestThread) { |
| 108 TestRunner runner; | 108 TestRunner runner; |
| 109 wchar_t command[1024] = {0}; | 109 wchar_t command[1024] = {0}; |
| 110 | 110 |
| 111 wsprintf(command, L"OpenThread %d", ::GetCurrentThreadId()); | 111 wsprintf(command, L"OpenThreadCmd %d", ::GetCurrentThreadId()); |
| 112 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); | 112 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(command)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace sandbox | 115 } // namespace sandbox |
| OLD | NEW |