| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/sync/util/character_set_converters.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 | |
| 11 using std::string; | |
| 12 | |
| 13 class CharacterSetConverterTest : public testing::Test { | |
| 14 }; | |
| 15 | |
| 16 TEST(NameTruncation, WindowsNameTruncation) { | |
| 17 using browser_sync::TrimPathStringToValidCharacter; | |
| 18 char array[] = {'1', '2', '\xc0', '\xe0', '3', '4', '\0'}; | |
| 19 std::string message(array); | |
| 20 ASSERT_EQ(message.length(), arraysize(array) - 1); | |
| 21 string::size_type old_length = message.length(); | |
| 22 while (old_length != 0) { | |
| 23 TrimPathStringToValidCharacter(&message); | |
| 24 if (old_length == 4) | |
| 25 EXPECT_EQ(3u, message.length()); | |
| 26 else | |
| 27 EXPECT_EQ(old_length, message.length()); | |
| 28 message.resize(message.length() - 1); | |
| 29 old_length = message.length(); | |
| 30 } | |
| 31 TrimPathStringToValidCharacter(&message); | |
| 32 } | |
| OLD | NEW |