summaryrefslogtreecommitdiffstats
path: root/base/string_util_unittest.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 18:26:11 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 18:26:11 +0000
commitef122393f32e86fb5312d373136d99de62274bf8 (patch)
tree645665e7b050dc4810032d7d13ff03a8c45fb53c /base/string_util_unittest.cc
parenta6c898d9732a133867229811c43e88274898d93f (diff)
downloadchromium_src-ef122393f32e86fb5312d373136d99de62274bf8.zip
chromium_src-ef122393f32e86fb5312d373136d99de62274bf8.tar.gz
chromium_src-ef122393f32e86fb5312d373136d99de62274bf8.tar.bz2
This CL addresses 2 issues:
- we were not computing the max request text size correctly in some cases (by forgetting the size of the &q= string) causing assertions. - the translate server might send inconsistent response in some cases, this CL makes sure we deal with them. A common case is when sending separators only strings, which we are not doing now anymore. Other more complicated case are less clear. BUG=35055 TEST=Visit www.spiegel.de and translate the page. The page should be translated correctly. Review URL: http://codereview.chromium.org/594023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_unittest.cc')
-rw-r--r--base/string_util_unittest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc
index 4473cc5..c6961fe 100644
--- a/base/string_util_unittest.cc
+++ b/base/string_util_unittest.cc
@@ -1484,4 +1484,17 @@ TEST(StringUtilTest, RemoveChars) {
EXPECT_EQ(std::string(), input);
}
+TEST(StringUtilTest, ContainsOnlyChars) {
+ // Providing an empty list of characters should return false but for the empty
+ // string.
+ EXPECT_TRUE(ContainsOnlyChars("", ""));
+ EXPECT_FALSE(ContainsOnlyChars("Hello", ""));
+
+ EXPECT_TRUE(ContainsOnlyChars("", "1234"));
+ EXPECT_TRUE(ContainsOnlyChars("1", "1234"));
+ EXPECT_TRUE(ContainsOnlyChars("1", "4321"));
+ EXPECT_TRUE(ContainsOnlyChars("123", "4321"));
+ EXPECT_FALSE(ContainsOnlyChars("123a", "4321"));
+}
+
} // namaspace base