OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
10 | 10 |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 { FPL("foo"), FPL("foo/") }, | 1221 { FPL("foo"), FPL("foo/") }, |
1222 { FPL("foo/"), FPL("foo/") } | 1222 { FPL("foo/"), FPL("foo/") } |
1223 }; | 1223 }; |
1224 for (size_t i = 0; i < arraysize(cases); ++i) { | 1224 for (size_t i = 0; i < arraysize(cases); ++i) { |
1225 FilePath input = FilePath(cases[i].input).NormalizePathSeparators(); | 1225 FilePath input = FilePath(cases[i].input).NormalizePathSeparators(); |
1226 FilePath expected = FilePath(cases[i].expected).NormalizePathSeparators(); | 1226 FilePath expected = FilePath(cases[i].expected).NormalizePathSeparators(); |
1227 EXPECT_EQ(expected.value(), input.AsEndingWithSeparator().value()); | 1227 EXPECT_EQ(expected.value(), input.AsEndingWithSeparator().value()); |
1228 } | 1228 } |
1229 } | 1229 } |
1230 | 1230 |
| 1231 #if defined(OS_ANDROID) |
| 1232 TEST_F(FilePathTest, ContentUriTest) { |
| 1233 const struct UnaryBooleanTestData cases[] = { |
| 1234 { FPL("content://foo.bar"), true }, |
| 1235 { FPL("content://foo.bar/"), true }, |
| 1236 { FPL("content://foo/bar"), true }, |
| 1237 { FPL("CoNTenT://foo.bar"), true }, |
| 1238 { FPL("content://"), true }, |
| 1239 { FPL("content:///foo.bar"), true }, |
| 1240 { FPL("content://3foo/bar"), true }, |
| 1241 { FPL("content://_foo/bar"), true }, |
| 1242 { FPL(".. "), false }, |
| 1243 { FPL("foo.bar"), false }, |
| 1244 { FPL("content:foo.bar"), false }, |
| 1245 { FPL("content:/foo.ba"), false }, |
| 1246 { FPL("content:/dir/foo.bar"), false }, |
| 1247 { FPL("content: //foo.bar"), false }, |
| 1248 { FPL("content%2a%2f%2f"), false }, |
| 1249 }; |
| 1250 |
| 1251 for (size_t i = 0; i < arraysize(cases); ++i) { |
| 1252 FilePath input(cases[i].input); |
| 1253 bool observed = input.IsContentUri(); |
| 1254 EXPECT_EQ(cases[i].expected, observed) << |
| 1255 "i: " << i << ", input: " << input.value(); |
| 1256 } |
| 1257 } |
| 1258 #endif |
| 1259 |
1231 } // namespace base | 1260 } // namespace base |
OLD | NEW |