Chromium Code Reviews| 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://"), true }, | |
| 1238 { FPL(".. "), false }, | |
|
Tom Sepez
2013/11/11 18:28:34
nit: how about adding some near misses:
content:fo
qinmin
2013/11/11 20:49:53
Done.
| |
| 1239 { FPL("foo.bar"), false }, | |
| 1240 }; | |
| 1241 | |
| 1242 for (size_t i = 0; i < arraysize(cases); ++i) { | |
| 1243 FilePath input(cases[i].input); | |
| 1244 bool observed = input.IsContentUri(); | |
| 1245 EXPECT_EQ(cases[i].expected, observed) << | |
| 1246 "i: " << i << ", input: " << input.value(); | |
| 1247 } | |
| 1248 } | |
| 1249 #endif | |
| 1250 | |
| 1231 } // namespace base | 1251 } // namespace base |
| OLD | NEW |