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 |