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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 struct UTF8TestData { | 40 struct UTF8TestData { |
41 const FilePath::CharType* native; | 41 const FilePath::CharType* native; |
42 const char* utf8; | 42 const char* utf8; |
43 }; | 43 }; |
44 | 44 |
45 // file_util winds up using autoreleased objects on the Mac, so this needs | 45 // file_util winds up using autoreleased objects on the Mac, so this needs |
46 // to be a PlatformTest | 46 // to be a PlatformTest |
47 class FilePathTest : public PlatformTest { | 47 class FilePathTest : public PlatformTest { |
48 protected: | 48 protected: |
49 virtual void SetUp() { | 49 virtual void SetUp() OVERRIDE { |
50 PlatformTest::SetUp(); | 50 PlatformTest::SetUp(); |
51 } | 51 } |
52 virtual void TearDown() { | 52 virtual void TearDown() OVERRIDE { |
53 PlatformTest::TearDown(); | 53 PlatformTest::TearDown(); |
54 } | 54 } |
55 }; | 55 }; |
56 | 56 |
57 TEST_F(FilePathTest, DirName) { | 57 TEST_F(FilePathTest, DirName) { |
58 const struct UnaryTestData cases[] = { | 58 const struct UnaryTestData cases[] = { |
59 { FPL(""), FPL(".") }, | 59 { FPL(""), FPL(".") }, |
60 { FPL("aa"), FPL(".") }, | 60 { FPL("aa"), FPL(".") }, |
61 { FPL("/aa/bb"), FPL("/aa") }, | 61 { FPL("/aa/bb"), FPL("/aa") }, |
62 { FPL("/aa/bb/"), FPL("/aa") }, | 62 { FPL("/aa/bb/"), FPL("/aa") }, |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 }; | 1110 }; |
1111 for (size_t i = 0; i < arraysize(cases); ++i) { | 1111 for (size_t i = 0; i < arraysize(cases); ++i) { |
1112 FilePath input(cases[i].input); | 1112 FilePath input(cases[i].input); |
1113 FilePath observed = input.NormalizePathSeparators(); | 1113 FilePath observed = input.NormalizePathSeparators(); |
1114 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << | 1114 EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << |
1115 "i: " << i << ", input: " << input.value(); | 1115 "i: " << i << ", input: " << input.value(); |
1116 } | 1116 } |
1117 } | 1117 } |
1118 | 1118 |
1119 #endif | 1119 #endif |
OLD | NEW |