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

Side by Side Diff: sandbox/src/integrity_level_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/dep_test.cc ('k') | sandbox/src/interception.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) 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 #include <windows.h> 5 #include <windows.h>
6 #include <atlsecurity.h> 6 #include <atlsecurity.h>
7 7
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "sandbox/src/sandbox.h" 10 #include "sandbox/src/sandbox.h"
11 #include "sandbox/src/sandbox_policy.h" 11 #include "sandbox/src/sandbox_policy.h"
(...skipping 26 matching lines...) Expand all
38 38
39 ::LocalFree(sid_low); 39 ::LocalFree(sid_low);
40 40
41 if (is_low_sid) 41 if (is_low_sid)
42 return SBOX_TEST_SUCCEEDED; 42 return SBOX_TEST_SUCCEEDED;
43 43
44 return SBOX_TEST_DENIED; 44 return SBOX_TEST_DENIED;
45 } 45 }
46 46
47 TEST(IntegrityLevelTest, TestLowILReal) { 47 TEST(IntegrityLevelTest, TestLowILReal) {
48 if (base::win::GetVersion() != base::win::VERSION_VISTA) 48 if (base::win::VERSION_VISTA != base::win::GetVersion())
49 return; 49 return;
50 50
51 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); 51 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
52 52
53 runner.SetTimeout(INFINITE); 53 runner.SetTimeout(INFINITE);
54 54
55 runner.GetPolicy()->SetIntegrityLevel(INTEGRITY_LEVEL_LOW); 55 runner.GetPolicy()->SetIntegrityLevel(INTEGRITY_LEVEL_LOW);
56 56
57 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel")); 57 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel"));
58 58
59 runner.SetTestState(BEFORE_REVERT); 59 runner.SetTestState(BEFORE_REVERT);
60 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel")); 60 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel"));
61 } 61 }
62 62
63 TEST(DelayedIntegrityLevelTest, TestLowILDelayed) { 63 TEST(DelayedIntegrityLevelTest, TestLowILDelayed) {
64 if (base::win::GetVersion() != base::win::VERSION_VISTA) 64 if (base::win::VERSION_VISTA != base::win::GetVersion())
65 return; 65 return;
66 66
67 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); 67 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
68 68
69 runner.SetTimeout(INFINITE); 69 runner.SetTimeout(INFINITE);
70 70
71 runner.GetPolicy()->SetDelayedIntegrityLevel(INTEGRITY_LEVEL_LOW); 71 runner.GetPolicy()->SetDelayedIntegrityLevel(INTEGRITY_LEVEL_LOW);
72 72
73 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel")); 73 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckIntegrityLevel"));
74 74
75 runner.SetTestState(BEFORE_REVERT); 75 runner.SetTestState(BEFORE_REVERT);
76 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"CheckIntegrityLevel")); 76 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"CheckIntegrityLevel"));
77 } 77 }
78 78
79 TEST(IntegrityLevelTest, TestNoILChange) { 79 TEST(IntegrityLevelTest, TestNoILChange) {
80 if (base::win::GetVersion() != base::win::VERSION_VISTA) 80 if (base::win::VERSION_VISTA != base::win::GetVersion())
81 return; 81 return;
82 82
83 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); 83 TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
84 84
85 runner.SetTimeout(INFINITE); 85 runner.SetTimeout(INFINITE);
86 86
87 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"CheckIntegrityLevel")); 87 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"CheckIntegrityLevel"));
88 } 88 }
89 89
90 } // namespace sandbox 90 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/dep_test.cc ('k') | sandbox/src/interception.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698