Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: app/l10n_util_unittest.cc

Issue 5959008: Remove wstring from l10n_util. Part 2.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/l10n_util.cc ('k') | chrome/browser/autocomplete/autocomplete.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <cstdlib> 8 #include <cstdlib>
9 #endif 9 #endif
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // TODO(beng): disabled until app strings move to app. 50 // TODO(beng): disabled until app strings move to app.
51 TEST_F(L10nUtilTest, DISABLED_GetString) { 51 TEST_F(L10nUtilTest, DISABLED_GetString) {
52 std::string s = l10n_util::GetStringUTF8(IDS_SIMPLE); 52 std::string s = l10n_util::GetStringUTF8(IDS_SIMPLE);
53 EXPECT_EQ(std::string("Hello World!"), s); 53 EXPECT_EQ(std::string("Hello World!"), s);
54 54
55 s = l10n_util::GetStringFUTF8(IDS_PLACEHOLDERS, 55 s = l10n_util::GetStringFUTF8(IDS_PLACEHOLDERS,
56 UTF8ToUTF16("chrome"), 56 UTF8ToUTF16("chrome"),
57 UTF8ToUTF16("10")); 57 UTF8ToUTF16("10"));
58 EXPECT_EQ(std::string("Hello, chrome. Your number is 10."), s); 58 EXPECT_EQ(std::string("Hello, chrome. Your number is 10."), s);
59 59
60 string16 s16 = l10n_util::GetStringFUTF16(IDS_PLACEHOLDERS_2, 20); 60 string16 s16 = l10n_util::GetStringFUTF16Int(IDS_PLACEHOLDERS_2, 20);
61 EXPECT_EQ(UTF8ToUTF16("You owe me $20."), s16); 61 EXPECT_EQ(UTF8ToUTF16("You owe me $20."), s16);
62 } 62 }
63 #endif // defined(OS_WIN) 63 #endif // defined(OS_WIN)
64 64
65 TEST_F(L10nUtilTest, TruncateString) { 65 TEST_F(L10nUtilTest, TruncateString) {
66 string16 string = ASCIIToUTF16("foooooey bxxxar baz"); 66 string16 string = ASCIIToUTF16("foooooey bxxxar baz");
67 67
68 // Make sure it doesn't modify the string if length > string length. 68 // Make sure it doesn't modify the string if length > string length.
69 EXPECT_EQ(string, l10n_util::TruncateString(string, 100)); 69 EXPECT_EQ(string, l10n_util::TruncateString(string, 100));
70 70
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); 388 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin"));
389 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); 389 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German"));
390 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); 390 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR"));
391 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); 391 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia"));
392 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); 392 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@"));
393 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); 393 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@"));
394 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); 394 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x"));
395 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); 395 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x="));
396 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); 396 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y"));
397 } 397 }
OLDNEW
« no previous file with comments | « app/l10n_util.cc ('k') | chrome/browser/autocomplete/autocomplete.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698