| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 { FPL("c:\\aa"), FPL("aa") }, | 202 { FPL("c:\\aa"), FPL("aa") }, |
| 203 { FPL("c:\\aa\\"), FPL("aa") }, | 203 { FPL("c:\\aa\\"), FPL("aa") }, |
| 204 { FPL("c:\\aa\\bb"), FPL("bb") }, | 204 { FPL("c:\\aa\\bb"), FPL("bb") }, |
| 205 { FPL("c:aa\\bb"), FPL("bb") }, | 205 { FPL("c:aa\\bb"), FPL("bb") }, |
| 206 #endif // FILE_PATH_USES_DRIVE_LETTERS | 206 #endif // FILE_PATH_USES_DRIVE_LETTERS |
| 207 #endif // FILE_PATH_USES_WIN_SEPARATORS | 207 #endif // FILE_PATH_USES_WIN_SEPARATORS |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 for (size_t i = 0; i < arraysize(cases); ++i) { | 210 for (size_t i = 0; i < arraysize(cases); ++i) { |
| 211 FilePath input(cases[i].input); | 211 FilePath input(cases[i].input); |
| 212 FilePath observed = input.BaseName(); | 212 FilePath::StringType observed = input.BaseName(); |
| 213 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << | 213 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed) << |
| 214 "i: " << i << ", input: " << input.value(); | 214 "i: " << i << ", input: " << input.value(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 TEST_F(FilePathTest, Append) { | 218 TEST_F(FilePathTest, Append) { |
| 219 const struct BinaryTestData cases[] = { | 219 const struct BinaryTestData cases[] = { |
| 220 { { FPL(""), FPL("cc") }, FPL("cc") }, | 220 { { FPL(""), FPL("cc") }, FPL("cc") }, |
| 221 { { FPL("."), FPL("ff") }, FPL("ff") }, | 221 { { FPL("."), FPL("ff") }, FPL("ff") }, |
| 222 { { FPL("/"), FPL("cc") }, FPL("/cc") }, | 222 { { FPL("/"), FPL("cc") }, FPL("/cc") }, |
| 223 { { FPL("/aa"), FPL("") }, FPL("/aa") }, | 223 { { FPL("/aa"), FPL("") }, FPL("/aa") }, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 FilePath(foo.value() + FILE_PATH_LITERAL("/bar.txt")))); | 399 FilePath(foo.value() + FILE_PATH_LITERAL("/bar.txt")))); |
| 400 #elif defined(OS_LINUX) | 400 #elif defined(OS_LINUX) |
| 401 EXPECT_FALSE(foo.Contains(foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); | 401 EXPECT_FALSE(foo.Contains(foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); |
| 402 #else | 402 #else |
| 403 // We can't really do this test on osx since the case-sensitivity of the | 403 // We can't really do this test on osx since the case-sensitivity of the |
| 404 // filesystem is configurable. | 404 // filesystem is configurable. |
| 405 #endif | 405 #endif |
| 406 | 406 |
| 407 // Note: whether | 407 // Note: whether |
| 408 } | 408 } |
| OLD | NEW |