diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 19:36:32 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 19:36:32 +0000 |
commit | 0bedb8a46053e44f667da0e800568c38e2150e4a (patch) | |
tree | cd14724a4078a65970c56e97cbd7c5a904c2f14c /base/string_util_unittest.cc | |
parent | 6fa508a1cef4a920f570174c77eafc5f21d808eb (diff) | |
download | chromium_src-0bedb8a46053e44f667da0e800568c38e2150e4a.zip chromium_src-0bedb8a46053e44f667da0e800568c38e2150e4a.tar.gz chromium_src-0bedb8a46053e44f667da0e800568c38e2150e4a.tar.bz2 |
This CL contains the back-end implementation of the translate feature. It adds a Translate method to the renderer.
On invocation this method triggers a traversal of the DOM page to retrieve the text nodes. The text node contents are then sent to the browser for actual translation (at this point, we just up-case the text for testing purpose).
The browser sends back the translated text to the renderer that replace the DOM text node values with the translated text.
BUG=None
TEST=Run the unit-tests.
Review URL: http://codereview.chromium.org/547013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_unittest.cc')
-rw-r--r-- | base/string_util_unittest.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index 2c1f484..9d848a4 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -166,6 +166,24 @@ TEST(StringUtilTest, CollapseWhitespaceASCII) { } } +TEST(StringUtilTest, ContainsOnlyWhitespaceASCII) { + EXPECT_TRUE(ContainsOnlyWhitespaceASCII("")); + EXPECT_TRUE(ContainsOnlyWhitespaceASCII(" ")); + EXPECT_TRUE(ContainsOnlyWhitespaceASCII("\t")); + EXPECT_TRUE(ContainsOnlyWhitespaceASCII("\t \r \n ")); + EXPECT_FALSE(ContainsOnlyWhitespaceASCII("a")); + EXPECT_FALSE(ContainsOnlyWhitespaceASCII("\thello\r \n ")); +} + +TEST(StringUtilTest, ContainsOnlyWhitespace) { + EXPECT_TRUE(ContainsOnlyWhitespace(ASCIIToUTF16(""))); + EXPECT_TRUE(ContainsOnlyWhitespace(ASCIIToUTF16(" "))); + EXPECT_TRUE(ContainsOnlyWhitespace(ASCIIToUTF16("\t"))); + EXPECT_TRUE(ContainsOnlyWhitespace(ASCIIToUTF16("\t \r \n "))); + EXPECT_FALSE(ContainsOnlyWhitespace(ASCIIToUTF16("a"))); + EXPECT_FALSE(ContainsOnlyWhitespace(ASCIIToUTF16("\thello\r \n "))); +} + TEST(StringUtilTest, IsStringUTF8) { EXPECT_TRUE(IsStringUTF8("abc")); EXPECT_TRUE(IsStringUTF8("\xc2\x81")); |