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

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

Issue 1168002: Fix the POC and some of unit tests to be build and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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/policy_target_test.cc ('k') | sandbox/tools/finder/ntundoc.h » ('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) 2006-2008 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 #include <shlobj.h> 5 #include <shlobj.h>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "sandbox/src/registry_policy.h" 8 #include "sandbox/src/registry_policy.h"
9 #include "sandbox/src/sandbox.h" 9 #include "sandbox/src/sandbox.h"
10 #include "sandbox/src/sandbox_policy.h" 10 #include "sandbox/src/sandbox_policy.h"
11 #include "sandbox/src/sandbox_factory.h" 11 #include "sandbox/src/sandbox_factory.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 TargetPolicy::REG_ALLOW_ANY, 95 TargetPolicy::REG_ALLOW_ANY,
96 L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); 96 L"HKEY_LOCAL_MACHINE\\Software\\Microsoft"));
97 97
98 // Tests read access on key allowed for read-write. 98 // Tests read access on key allowed for read-write.
99 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 99 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
100 L"Reg_OpenKey create read HKEY_LOCAL_MACHINE software\\microsoft")); 100 L"Reg_OpenKey create read HKEY_LOCAL_MACHINE software\\microsoft"));
101 101
102 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 102 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
103 L"Reg_OpenKey open read HKEY_LOCAL_MACHINE software\\microsoft")); 103 L"Reg_OpenKey open read HKEY_LOCAL_MACHINE software\\microsoft"));
104 104
105 // Tests write access on key allowed for read-write. 105 if (::IsUserAnAdmin()) {
106 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 106 // Tests write access on key allowed for read-write.
107 L"Reg_OpenKey create write HKEY_LOCAL_MACHINE software\\microsoft")); 107 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
108 L"Reg_OpenKey create write HKEY_LOCAL_MACHINE software\\microsoft"));
108 109
109 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 110 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
110 L"Reg_OpenKey open write HKEY_LOCAL_MACHINE software\\microsoft")); 111 L"Reg_OpenKey open write HKEY_LOCAL_MACHINE software\\microsoft"));
112 }
111 113
112 // Tests subdirectory access on keys where we don't have subdirectory acess. 114 // Tests subdirectory access on keys where we don't have subdirectory acess.
113 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Reg_OpenKey create read " 115 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Reg_OpenKey create read "
114 L"HKEY_LOCAL_MACHINE software\\microsoft\\Windows")); 116 L"HKEY_LOCAL_MACHINE software\\microsoft\\Windows"));
115 117
116 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Reg_OpenKey open read " 118 EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"Reg_OpenKey open read "
117 L"HKEY_LOCAL_MACHINE software\\microsoft\\windows")); 119 L"HKEY_LOCAL_MACHINE software\\microsoft\\windows"));
118 120
119 // Tests to see if we can create keys where we dont have subdirectory access. 121 // Tests to see if we can create keys where we dont have subdirectory access.
120 // This is denied. 122 // This is denied.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 280
279 // Tests maximum allowed access where we only have read-only access. 281 // Tests maximum allowed access where we only have read-only access.
280 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 282 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
281 L"Reg_OpenKey create maximum_allowed HKEY_CURRENT_USER software")); 283 L"Reg_OpenKey create maximum_allowed HKEY_CURRENT_USER software"));
282 284
283 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest( 285 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(
284 L"Reg_OpenKey open maximum_allowed HKEY_CURRENT_USER software")); 286 L"Reg_OpenKey open maximum_allowed HKEY_CURRENT_USER software"));
285 } 287 }
286 288
287 } // namespace sandbox 289 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/policy_target_test.cc ('k') | sandbox/tools/finder/ntundoc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698