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

Side by Side Diff: sandbox/win/src/policy_engine_unittest.cc

Issue 1539423002: Revert of Switch to standard integer types in sandbox/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « sandbox/win/src/policy_engine_processor.cc ('k') | sandbox/win/src/policy_low_level.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-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 <stddef.h>
6 #include <stdint.h>
7
8 #include "sandbox/win/src/policy_engine_params.h" 5 #include "sandbox/win/src/policy_engine_params.h"
9 #include "sandbox/win/src/policy_engine_processor.h" 6 #include "sandbox/win/src/policy_engine_processor.h"
10 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
11 8
12 #define POLPARAMS_BEGIN(x) sandbox::ParameterSet x[] = { 9 #define POLPARAMS_BEGIN(x) sandbox::ParameterSet x[] = {
13 #define POLPARAM(p) sandbox::ParamPickerMake(p), 10 #define POLPARAM(p) sandbox::ParamPickerMake(p),
14 #define POLPARAMS_END } 11 #define POLPARAMS_END }
15 12
16 namespace sandbox { 13 namespace sandbox {
17 14
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 54
58 // Add rule set #2 55 // Add rule set #2
59 opcode_maker.MakeOpWStringMatch(FileNameArg, L".TXT", 56 opcode_maker.MakeOpWStringMatch(FileNameArg, L".TXT",
60 kSeekToEnd, CASE_INSENSITIVE, kPolNone); 57 kSeekToEnd, CASE_INSENSITIVE, kPolNone);
61 opcode_maker.MakeOpNumberMatch(CreationDispositionArg, CREATE_NEW, 58 opcode_maker.MakeOpNumberMatch(CreationDispositionArg, CREATE_NEW,
62 kPolNegateEval); 59 kPolNegateEval);
63 opcode_maker.MakeOpAction(FAKE_ACCESS_DENIED, kPolNone); 60 opcode_maker.MakeOpAction(FAKE_ACCESS_DENIED, kPolNone);
64 policy->opcode_count = 7; 61 policy->opcode_count = 7;
65 62
66 const wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt"; 63 const wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt";
67 uint32_t creation_mode = OPEN_EXISTING; 64 uint32 creation_mode = OPEN_EXISTING;
68 uint32_t flags = FILE_ATTRIBUTE_NORMAL; 65 uint32 flags = FILE_ATTRIBUTE_NORMAL;
69 void* security_descriptor = NULL; 66 void* security_descriptor = NULL;
70 67
71 POLPARAMS_BEGIN(eval_params) 68 POLPARAMS_BEGIN(eval_params)
72 POLPARAM(filename) 69 POLPARAM(filename)
73 POLPARAM(creation_mode) 70 POLPARAM(creation_mode)
74 POLPARAM(flags) 71 POLPARAM(flags)
75 POLPARAM(security_descriptor) 72 POLPARAM(security_descriptor)
76 POLPARAMS_END; 73 POLPARAMS_END;
77 74
78 PolicyResult pr; 75 PolicyResult pr;
(...skipping 17 matching lines...) Expand all
96 // Changing creation_mode such that evaluation should match rule #2. 93 // Changing creation_mode such that evaluation should match rule #2.
97 creation_mode = OPEN_ALWAYS; 94 creation_mode = OPEN_ALWAYS;
98 pr = pol_ev.Evaluate(kShortEval, eval_params, _countof(eval_params)); 95 pr = pol_ev.Evaluate(kShortEval, eval_params, _countof(eval_params));
99 EXPECT_EQ(POLICY_MATCH, pr); 96 EXPECT_EQ(POLICY_MATCH, pr);
100 EXPECT_EQ(FAKE_ACCESS_DENIED, pol_ev.GetAction()); 97 EXPECT_EQ(FAKE_ACCESS_DENIED, pol_ev.GetAction());
101 98
102 delete [] reinterpret_cast<char*>(policy); 99 delete [] reinterpret_cast<char*>(policy);
103 } 100 }
104 101
105 } // namespace sandbox 102 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_engine_processor.cc ('k') | sandbox/win/src/policy_low_level.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698