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 30 matching lines...) Expand all Loading... |
41 int expected; | 41 int expected; |
42 }; | 42 }; |
43 | 43 |
44 struct UTF8TestData { | 44 struct UTF8TestData { |
45 const FilePath::CharType* native; | 45 const FilePath::CharType* native; |
46 const char* utf8; | 46 const char* utf8; |
47 }; | 47 }; |
48 | 48 |
49 // file_util winds up using autoreleased objects on the Mac, so this needs | 49 // file_util winds up using autoreleased objects on the Mac, so this needs |
50 // to be a PlatformTest | 50 // to be a PlatformTest |
51 class FilePathTest : public PlatformTest { | 51 typedef PlatformTest FilePathTest; |
52 protected: | |
53 virtual void SetUp() override { | |
54 PlatformTest::SetUp(); | |
55 } | |
56 virtual void TearDown() override { | |
57 PlatformTest::TearDown(); | |
58 } | |
59 }; | |
60 | 52 |
61 TEST_F(FilePathTest, DirName) { | 53 TEST_F(FilePathTest, DirName) { |
62 const struct UnaryTestData cases[] = { | 54 const struct UnaryTestData cases[] = { |
63 { FPL(""), FPL(".") }, | 55 { FPL(""), FPL(".") }, |
64 { FPL("aa"), FPL(".") }, | 56 { FPL("aa"), FPL(".") }, |
65 { FPL("/aa/bb"), FPL("/aa") }, | 57 { FPL("/aa/bb"), FPL("/aa") }, |
66 { FPL("/aa/bb/"), FPL("/aa") }, | 58 { FPL("/aa/bb/"), FPL("/aa") }, |
67 { FPL("/aa/bb//"), FPL("/aa") }, | 59 { FPL("/aa/bb//"), FPL("/aa") }, |
68 { FPL("/aa/bb/ccc"), FPL("/aa/bb") }, | 60 { FPL("/aa/bb/ccc"), FPL("/aa/bb") }, |
69 { FPL("/aa"), FPL("/") }, | 61 { FPL("/aa"), FPL("/") }, |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 for (size_t i = 0; i < arraysize(cases); ++i) { | 1267 for (size_t i = 0; i < arraysize(cases); ++i) { |
1276 FilePath input(cases[i].input); | 1268 FilePath input(cases[i].input); |
1277 bool observed = input.IsContentUri(); | 1269 bool observed = input.IsContentUri(); |
1278 EXPECT_EQ(cases[i].expected, observed) << | 1270 EXPECT_EQ(cases[i].expected, observed) << |
1279 "i: " << i << ", input: " << input.value(); | 1271 "i: " << i << ", input: " << input.value(); |
1280 } | 1272 } |
1281 } | 1273 } |
1282 #endif | 1274 #endif |
1283 | 1275 |
1284 } // namespace base | 1276 } // namespace base |
OLD | NEW |