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

Unified Diff: sandbox/win/src/file_policy_test.cc

Issue 432543005: Replace NT prefix in sandbox rules match string to handle correct wildcard escaping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include statement Created 6 years, 4 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 | sandbox/win/src/filesystem_policy.h » ('j') | sandbox/win/src/filesystem_policy.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/file_policy_test.cc
diff --git a/sandbox/win/src/file_policy_test.cc b/sandbox/win/src/file_policy_test.cc
index adda1a5f8742626a91f7973dc33fa6e053abe88d..b0d033b7de6750f0e837be9ff5e0de8c5b48e70e 100644
--- a/sandbox/win/src/file_policy_test.cc
+++ b/sandbox/win/src/file_policy_test.cc
@@ -9,6 +9,7 @@
#include <winioctl.h>
#include "base/win/scoped_handle.h"
+#include "sandbox/win/src/filesystem_policy.h"
#include "sandbox/win/src/nt_internals.h"
#include "sandbox/win/src/sandbox.h"
#include "sandbox/win/src/sandbox_factory.h"
@@ -596,4 +597,28 @@ TEST(FilePolicyTest, DISABLED_TestReparsePoint) {
EXPECT_TRUE(::RemoveDirectory(subfolder.c_str()));
}
+TEST(FilePolicyTest, CheckExistingNTPrefixEscape) {
+ base::string16 name = L"\\??\\NAME";
+
+ base::string16 result = FixNTPrefixForMatch(name);
+
+ EXPECT_STREQ(result.c_str(), L"\\/?/?\\NAME");
+}
+
+TEST(FilePolicyTest, CheckEscapedNTPrefixNoEscape) {
+ base::string16 name = L"\\/?/?\\NAME";
+
+ base::string16 result = FixNTPrefixForMatch(name);
+
+ EXPECT_STREQ(result.c_str(), name.c_str());
+}
+
+TEST(FilePolicyTest, CheckMissingNTPrefixEscape) {
+ base::string16 name = L"C:\\NAME";
+
+ base::string16 result = FixNTPrefixForMatch(name);
+
+ EXPECT_STREQ(result.c_str(), L"\\/?/?\\C:\\NAME");
+}
+
} // namespace sandbox
« no previous file with comments | « no previous file | sandbox/win/src/filesystem_policy.h » ('j') | sandbox/win/src/filesystem_policy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698