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 }, | |
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
| |
1238 { FPL("content://"), false }, | |
1239 { FPL(".. "), false }, | |
1240 { FPL("foo.bar"), false }, | |
1241 { FPL("content:foo.bar"), false }, | |
1242 { FPL("content:/foo.ba"), false }, | |
1243 { FPL("content:/dir/foo.bar"), false }, | |
1244 { FPL("content:///foo.bar"), false }, | |
1245 { FPL("content: //foo.bar"), false }, | |
1246 { FPL("content%2a%2f%2f"), false }, | |
1247 }; | |
1248 | |
1249 for (size_t i = 0; i < arraysize(cases); ++i) { | |
1250 FilePath input(cases[i].input); | |
1251 bool observed = input.IsContentUri(); | |
1252 EXPECT_EQ(cases[i].expected, observed) << | |
1253 "i: " << i << ", input: " << input.value(); | |
1254 } | |
1255 } | |
1256 #endif | |
1257 | |
1231 } // namespace base | 1258 } // namespace base |
OLD | NEW |