Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Side by Side Diff: sandbox/src/dep_test.cc

Issue 6816024: Revert 80819 due to failed tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/src/Wow64.cc ('k') | sandbox/src/integrity_level_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "sandbox/src/dep.h" 5 #include "sandbox/src/dep.h"
6 6
7 #include "sandbox/src/sandbox_utils.h" 7 #include "sandbox/src/sandbox_utils.h"
8 #include "sandbox/tests/common/controller.h" 8 #include "sandbox/tests/common/controller.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace sandbox { 11 namespace sandbox {
12 12
13 namespace { 13 namespace {
14 14
15 class DepTest : public testing::Test {
16 public:
17 static bool IsTestCaseDisabled() {
18 OSVERSIONINFOEX version_info;
19 version_info.dwOSVersionInfoSize = sizeof version_info;
20 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
21
22 // Windows 2000 doesn't support DEP at all.
23 if (version_info.dwMajorVersion == 5 && version_info.dwMinorVersion == 0)
24 return true;
25
26 // Windows XP Service Pack 0 and 1 don't support DEP at all.
27 if (version_info.dwMajorVersion == 5 && version_info.dwMinorVersion == 1
28 && version_info.wServicePackMajor < 2)
29 return true;
30
31 // Bug 1212371 Vista SP0 DEP support is half-baked. Nobody seem to have
32 // noticed!
33 if (version_info.dwMajorVersion == 6 &&
34 version_info.wServicePackMajor == 0)
35 return true;
36
37 return false;
38 }
39 };
40
15 BYTE kReturnCode[] = { 41 BYTE kReturnCode[] = {
16 // ret 42 // ret
17 0xC3, 43 0xC3,
18 }; 44 };
19 45
20 typedef void (*NullFunction)(); 46 typedef void (*NullFunction)();
21 47
22 // This doesn't fail on Vista Service Pack 0 but it does on XP SP2 and Vista 48 // This doesn't fail on Vista Service Pack 0 but it does on XP SP2 and Vista
23 // SP1. I guess this is a bug in Vista SP0 w.r.t .data PE section. Needs 49 // SP1. I guess this is a bug in Vista SP0 w.r.t .data PE section. Needs
24 // investigation to be sure it is a bug and not an error on my part. 50 // investigation to be sure it is a bug and not an error on my part.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return SBOX_TEST_SUCCEEDED; 160 return SBOX_TEST_SUCCEEDED;
135 default: 161 default:
136 return SBOX_TEST_INVALID_PARAMETER; 162 return SBOX_TEST_INVALID_PARAMETER;
137 } 163 }
138 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 164 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
139 } 165 }
140 166
141 } // namespace 167 } // namespace
142 168
143 // This test is disabled. See bug 1275842 169 // This test is disabled. See bug 1275842
144 TEST(DepTest, DISABLED_TestDepDisable) { 170 TEST_F(DepTest, DISABLED_TestDepDisable) {
145 TestRunner runner(JOB_UNPROTECTED, USER_INTERACTIVE, USER_INTERACTIVE); 171 TestRunner runner(JOB_UNPROTECTED, USER_INTERACTIVE, USER_INTERACTIVE);
146 172
147 runner.SetTimeout(INFINITE); 173 runner.SetTimeout(INFINITE);
148 174
149 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 1")); 175 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 1"));
150 // TODO(maruel): bug 1207762 Somehow test ATL7 176 // TODO(maruel): bug 1207762 Somehow test ATL7
151 // EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 2")); 177 // EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 2"));
152 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 3")); 178 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 3"));
153 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 4")); 179 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 4"));
154 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 5")); 180 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 5"));
155 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 6")); 181 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDepLevel 6"));
156 } 182 }
157 183
158 } // namespace sandbox 184 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/Wow64.cc ('k') | sandbox/src/integrity_level_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698