| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/string_util.h" | |
| 8 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 9 |
| 11 namespace base { | 10 namespace base { |
| 12 | 11 |
| 13 namespace { | 12 namespace { |
| 14 | 13 |
| 15 // Given a null-terminated string of wchar_t with each wchar_t representing | 14 // Given a null-terminated string of wchar_t with each wchar_t representing |
| 16 // a UTF-16 code unit, returns a string16 made up of wchar_t's in the input. | 15 // a UTF-16 code unit, returns a string16 made up of wchar_t's in the input. |
| 17 // Each wchar_t should be <= 0xFFFF and a non-BMP character (> U+FFFF) | 16 // Each wchar_t should be <= 0xFFFF and a non-BMP character (> U+FFFF) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 EXPECT_EQ(arraysize(wmulti) - 1, wmultistring.length()); | 221 EXPECT_EQ(arraysize(wmulti) - 1, wmultistring.length()); |
| 223 std::string expected; | 222 std::string expected; |
| 224 memcpy(WriteInto(&expected, arraysize(multi)), multi, sizeof(multi)); | 223 memcpy(WriteInto(&expected, arraysize(multi)), multi, sizeof(multi)); |
| 225 EXPECT_EQ(arraysize(multi) - 1, expected.length()); | 224 EXPECT_EQ(arraysize(multi) - 1, expected.length()); |
| 226 const std::string& converted = WideToUTF8(wmultistring); | 225 const std::string& converted = WideToUTF8(wmultistring); |
| 227 EXPECT_EQ(arraysize(multi) - 1, converted.length()); | 226 EXPECT_EQ(arraysize(multi) - 1, converted.length()); |
| 228 EXPECT_EQ(expected, converted); | 227 EXPECT_EQ(expected, converted); |
| 229 } | 228 } |
| 230 | 229 |
| 231 } // base | 230 } // base |
| OLD | NEW |