| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "public/platform/FilePathConversion.h" | 5 #include "public/platform/FilePathConversion.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "platform/wtf/text/WTFString.h" |
| 8 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/text/WTFString.h" | |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 TEST(FilePathConversionTest, convert) { | 14 TEST(FilePathConversionTest, convert) { |
| 15 String test8bitString("path"); | 15 String test8bitString("path"); |
| 16 String test8bitLatin1("a\xC4"); | 16 String test8bitLatin1("a\xC4"); |
| 17 | 17 |
| 18 static const UChar test[5] = {0x0070, 0x0061, 0x0074, 0x0068, 0}; // path | 18 static const UChar test[5] = {0x0070, 0x0061, 0x0074, 0x0068, 0}; // path |
| 19 static const UChar testLatin1[3] = {0x0061, 0x00C4, 0}; // a\xC4 | 19 static const UChar testLatin1[3] = {0x0061, 0x00C4, 0}; // a\xC4 |
| 20 static const UChar testUTF16[3] = {0x6587, 0x5B57, 0}; // \u6587 \u5B57 | 20 static const UChar testUTF16[3] = {0x6587, 0x5B57, 0}; // \u6587 \u5B57 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 45 FilePathToWebString(base::FilePath(FILE_PATH_LITERAL("path"))) | 45 FilePathToWebString(base::FilePath(FILE_PATH_LITERAL("path"))) |
| 46 .utf8() | 46 .utf8() |
| 47 .data()); | 47 .data()); |
| 48 EXPECT_STREQ(test8bitLatin1.utf8().data(), | 48 EXPECT_STREQ(test8bitLatin1.utf8().data(), |
| 49 FilePathToWebString(pathLatin1).utf8().data()); | 49 FilePathToWebString(pathLatin1).utf8().data()); |
| 50 EXPECT_STREQ(test16bitUTF16.utf8().data(), | 50 EXPECT_STREQ(test16bitUTF16.utf8().data(), |
| 51 FilePathToWebString(pathUTF16).utf8().data()); | 51 FilePathToWebString(pathUTF16).utf8().data()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |