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

Unified Diff: webrtc/base/stringencode_unittest.cc

Issue 1344143002: Catching more errors when parsing ICE server URLs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merging with master. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/stringencode.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/stringencode_unittest.cc
diff --git a/webrtc/base/stringencode_unittest.cc b/webrtc/base/stringencode_unittest.cc
index 77fae35fb90da75c840fb263cbe4b7f155fd7b63..406d9c7d4aa599d0d69cbcd51e85f206fb4cec8c 100644
--- a/webrtc/base/stringencode_unittest.cc
+++ b/webrtc/base/stringencode_unittest.cc
@@ -298,6 +298,22 @@ TEST(TokenizeTest, TokenizeWithMarks) {
ASSERT_STREQ("E F", fields.at(3).c_str());
}
+TEST(TokenizeTest, TokenizeWithEmptyTokens) {
+ std::vector<std::string> fields;
+ EXPECT_EQ(3ul, tokenize_with_empty_tokens("a.b.c", '.', &fields));
+ EXPECT_EQ("a", fields[0]);
+ EXPECT_EQ("b", fields[1]);
+ EXPECT_EQ("c", fields[2]);
+
+ EXPECT_EQ(3ul, tokenize_with_empty_tokens("..c", '.', &fields));
+ EXPECT_TRUE(fields[0].empty());
+ EXPECT_TRUE(fields[1].empty());
+ EXPECT_EQ("c", fields[2]);
+
+ EXPECT_EQ(1ul, tokenize_with_empty_tokens("", '.', &fields));
+ EXPECT_TRUE(fields[0].empty());
+}
+
TEST(TokenizeFirstTest, NoLeadingSpaces) {
std::string token;
std::string rest;
@@ -428,4 +444,5 @@ TEST(BoolTest, RoundTrip) {
EXPECT_TRUE(FromString(ToString(false), &value));
EXPECT_FALSE(value);
}
+
} // namespace rtc
« no previous file with comments | « webrtc/base/stringencode.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698