| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 EXPECT_EQ(SBOX_TEST_DENIED, | 70 EXPECT_EQ(SBOX_TEST_DENIED, |
| 71 runner.RunTest( | 71 runner.RunTest( |
| 72 L"OpenKey HKLM " | 72 L"OpenKey HKLM " |
| 73 L"\"Software\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\"")); | 73 L"\"Software\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\"")); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Tests that the permissions on the Windowstation does not allow the sandbox | 76 // Tests that the permissions on the Windowstation does not allow the sandbox |
| 77 // to get to the interactive desktop or to make the sbox desktop interactive. | 77 // to get to the interactive desktop or to make the sbox desktop interactive. |
| 78 TEST(ValidationSuite, TestDesktop) { | 78 TEST(ValidationSuite, TestDesktop) { |
| 79 TestRunner runner; | 79 TestRunner runner; |
| 80 runner.GetPolicy()->SetDesktop(L"sbox_validation_desktop"); | 80 runner.GetPolicy()->SetAlternateDesktop(false); |
| 81 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"OpenInteractiveDesktop NULL")); | 81 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"OpenInteractiveDesktop NULL")); |
| 82 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"SwitchToSboxDesktop NULL")); | 82 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"SwitchToSboxDesktop NULL")); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Tests if the windows are correctly protected by the sandbox. | 85 // Tests if the windows are correctly protected by the sandbox. |
| 86 TEST(ValidationSuite, TestWindows) { | 86 TEST(ValidationSuite, TestWindows) { |
| 87 TestRunner runner; | 87 TestRunner runner; |
| 88 wchar_t command[1024] = {0}; | 88 wchar_t command[1024] = {0}; |
| 89 | 89 |
| 90 wsprintf(command, L"ValidWindow %d", ::GetDesktopWindow()); | 90 wsprintf(command, L"ValidWindow %d", ::GetDesktopWindow()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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"OpenThread %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 |