summaryrefslogtreecommitdiffstats
path: root/sandbox/src
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/src')
-rw-r--r--sandbox/src/policy_low_level_unittest.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sandbox/src/policy_low_level_unittest.cc b/sandbox/src/policy_low_level_unittest.cc
index 19d6656..20d1777 100644
--- a/sandbox/src/policy_low_level_unittest.cc
+++ b/sandbox/src/policy_low_level_unittest.cc
@@ -13,8 +13,11 @@
namespace sandbox {
+bool SetupNtdllImports();
+
// Testing that we allow opcode generation on valid string patterns.
TEST(PolicyEngineTest, StringPatternsOK) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF, 0, L"c:\\adobe\\ver??\\", CASE_SENSITIVE));
EXPECT_TRUE(pr.AddStringMatch(IF, 0, L"*.tmp", CASE_SENSITIVE));
@@ -26,6 +29,7 @@ TEST(PolicyEngineTest, StringPatternsOK) {
// Testing that we signal invalid string patterns.
TEST(PolicyEngineTest, StringPatternsBAD) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_FALSE(pr.AddStringMatch(IF, 0, L"one**two", CASE_SENSITIVE));
EXPECT_FALSE(pr.AddStringMatch(IF, 0, L"**three", CASE_SENSITIVE));
@@ -46,6 +50,7 @@ PolicyGlobal* MakePolicyMemory() {
// The simplest test using LowLevelPolicy it should test a single opcode which
// does a exact string comparison.
TEST(PolicyEngineTest, SimpleStrMatch) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF, 0, L"z:\\Directory\\domo.txt",
CASE_INSENSITIVE));
@@ -78,6 +83,7 @@ TEST(PolicyEngineTest, SimpleStrMatch) {
}
TEST(PolicyEngineTest, SimpleIfNotStrMatch) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\",
CASE_SENSITIVE));
@@ -115,6 +121,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatch) {
}
TEST(PolicyEngineTest, SimpleIfNotStrMatchWild1) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\*",
CASE_SENSITIVE));
@@ -147,6 +154,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild1) {
}
TEST(PolicyEngineTest, SimpleIfNotStrMatchWild2) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\*.txt",
CASE_SENSITIVE));
@@ -184,6 +192,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild2) {
}
TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild1) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\*",
CASE_SENSITIVE));
@@ -231,6 +240,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild1) {
}
TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild2) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddNumberMatch(IF, 1, 24, EQUAL));
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\GoogleV?\\*.txt",
@@ -303,6 +313,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild2) {
// Testing one single rule in one single service. The service is made to
// resemble NtCreateFile.
TEST(PolicyEngineTest, OneRuleTest) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF, 0, L"c:\\*Microsoft*\\*.txt",
CASE_SENSITIVE));
@@ -373,6 +384,7 @@ TEST(PolicyEngineTest, OneRuleTest) {
// Testing 3 rules in 3 services. Two of the services resemble File services.
TEST(PolicyEngineTest, ThreeRulesTest) {
+ SetupNtdllImports();
PolicyRule pr_pipe(FAKE_SUCCESS);
EXPECT_TRUE(pr_pipe.AddStringMatch(IF, 0, L"\\\\/?/?\\Pipe\\Chrome.*",
CASE_INSENSITIVE));