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

Unified Diff: sandbox/src/policy_low_level_unittest.cc

Issue 113548: Fix a crash in the unittests caused by the fact that the order of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/src/policy_low_level_unittest.cc
===================================================================
--- sandbox/src/policy_low_level_unittest.cc (revision 16307)
+++ sandbox/src/policy_low_level_unittest.cc (working copy)
@@ -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 @@
// 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 @@
// 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, SimpleIfNotStrMatch) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\",
CASE_SENSITIVE));
@@ -115,6 +121,7 @@
}
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, 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, IfNotStrMatchTwoRulesWild1) {
+ SetupNtdllImports();
PolicyRule pr(ASK_BROKER);
EXPECT_TRUE(pr.AddStringMatch(IF_NOT, 0, L"c:\\Microsoft\\*",
CASE_SENSITIVE));
@@ -231,6 +240,7 @@
}
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 @@
// 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 @@
// 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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698