Index: base/files/file_path_unittest.cc |
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc |
index 8b2fcf531c96e6c4bdac6e45307faf16cf5d4287..2e94a83088824a4d21fb214d77cb7b335b878d79 100644 |
--- a/base/files/file_path_unittest.cc |
+++ b/base/files/file_path_unittest.cc |
@@ -1228,4 +1228,31 @@ TEST_F(FilePathTest, AsEndingWithSeparator) { |
} |
} |
+#if defined(OS_ANDROID) |
+TEST_F(FilePathTest, ContentUriTest) { |
+ const struct UnaryBooleanTestData cases[] = { |
+ { FPL("content://foo.bar"), true }, |
+ { FPL("content://foo.bar/"), true }, |
+ { FPL("content://foo/bar"), true }, |
+ { FPL("CoNTenT://foo.bar"), true }, |
jar (doing other things)
2013/11/13 01:03:28
Since you wrote code to distinguish the presence o
qinmin
2013/11/13 23:42:43
added the above tests, since the first letter chec
|
+ { FPL("content://"), false }, |
+ { FPL(".. "), false }, |
+ { FPL("foo.bar"), false }, |
+ { FPL("content:foo.bar"), false }, |
+ { FPL("content:/foo.ba"), false }, |
+ { FPL("content:/dir/foo.bar"), false }, |
+ { FPL("content:///foo.bar"), false }, |
+ { FPL("content: //foo.bar"), false }, |
+ { FPL("content%2a%2f%2f"), false }, |
+ }; |
+ |
+ for (size_t i = 0; i < arraysize(cases); ++i) { |
+ FilePath input(cases[i].input); |
+ bool observed = input.IsContentUri(); |
+ EXPECT_EQ(cases[i].expected, observed) << |
+ "i: " << i << ", input: " << input.value(); |
+ } |
+} |
+#endif |
+ |
} // namespace base |