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/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 { FPL("/foo.tar.tar.gz"), FPL(".tar.gz") }, | 746 { FPL("/foo.tar.tar.gz"), FPL(".tar.gz") }, |
747 { FPL("/foo.tar.gz.gz"), FPL(".gz.gz") }, | 747 { FPL("/foo.tar.gz.gz"), FPL(".gz.gz") }, |
748 { FPL("."), FPL("") }, | 748 { FPL("."), FPL("") }, |
749 { FPL(".."), FPL("") }, | 749 { FPL(".."), FPL("") }, |
750 { FPL("./foo"), FPL("") }, | 750 { FPL("./foo"), FPL("") }, |
751 { FPL("./foo.ext"), FPL(".ext") }, | 751 { FPL("./foo.ext"), FPL(".ext") }, |
752 { FPL("/foo.ext1/bar.ext2"), FPL(".ext2") }, | 752 { FPL("/foo.ext1/bar.ext2"), FPL(".ext2") }, |
753 { FPL("/foo.bar////"), FPL(".bar") }, | 753 { FPL("/foo.bar////"), FPL(".bar") }, |
754 { FPL("/foo.bar/.."), FPL("") }, | 754 { FPL("/foo.bar/.."), FPL("") }, |
755 { FPL("/foo.bar/..////"), FPL("") }, | 755 { FPL("/foo.bar/..////"), FPL("") }, |
| 756 { FPL("/foo.1234.user.js"), FPL(".user.js") }, |
| 757 { FPL("foo.user.js"), FPL(".user.js") }, |
| 758 { FPL("/foo.1234.luser.js"), FPL(".js") }, |
| 759 { FPL("/user.js"), FPL(".js") }, |
756 }; | 760 }; |
757 for (unsigned int i = 0; i < arraysize(cases); ++i) { | 761 for (unsigned int i = 0; i < arraysize(cases); ++i) { |
758 FilePath path(cases[i].input); | 762 FilePath path(cases[i].input); |
759 FilePath::StringType extension = path.Extension(); | 763 FilePath::StringType extension = path.Extension(); |
760 EXPECT_STREQ(cases[i].expected, extension.c_str()) << "i: " << i << | 764 EXPECT_STREQ(cases[i].expected, extension.c_str()) << "i: " << i << |
761 ", path: " << path.value(); | 765 ", path: " << path.value(); |
762 } | 766 } |
763 } | 767 } |
764 | 768 |
765 TEST_F(FilePathTest, InsertBeforeExtension) { | 769 TEST_F(FilePathTest, InsertBeforeExtension) { |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 }; | 1152 }; |
1149 for (size_t i = 0; i < arraysize(cases); ++i) { | 1153 for (size_t i = 0; i < arraysize(cases); ++i) { |
1150 FilePath input(cases[i].input); | 1154 FilePath input(cases[i].input); |
1151 FilePath observed = input.NormalizePathSeparators(); | 1155 FilePath observed = input.NormalizePathSeparators(); |
1152 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << | 1156 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << |
1153 "i: " << i << ", input: " << input.value(); | 1157 "i: " << i << ", input: " << input.value(); |
1154 } | 1158 } |
1155 } | 1159 } |
1156 | 1160 |
1157 #endif | 1161 #endif |
OLD | NEW |