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

Unified Diff: third_party/WebKit/Source/wtf/text/CStringTest.cpp

Issue 2240053002: Replace WTF_LOG() with NETWORK_DVLOG() or RESOURCE_LOADING_DVLOG(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply review comments, and add CString printer Created 4 years, 4 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 | « third_party/WebKit/Source/wtf/text/CString.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/CStringTest.cpp
diff --git a/third_party/WebKit/Source/wtf/text/CStringTest.cpp b/third_party/WebKit/Source/wtf/text/CStringTest.cpp
index 6e4956d1be3be43338383ade3766225816396261..e595c4722a0cc443cd9a988f5db5187428766ecb 100644
--- a/third_party/WebKit/Source/wtf/text/CStringTest.cpp
+++ b/third_party/WebKit/Source/wtf/text/CStringTest.cpp
@@ -29,6 +29,18 @@
namespace WTF {
+namespace {
+
+CString printedString(const CString& string)
+{
+ std::ostringstream output;
+ output << string;
+ const std::string& result = output.str();
+ return CString(result.data(), result.length());
+}
+
+} // anonymous namespace
+
TEST(CStringTest, NullStringConstructor)
{
CString string;
@@ -197,4 +209,12 @@ TEST(CStringTest, Comparison)
EXPECT_TRUE(c != d);
}
+TEST(CStringTest, Printer)
+{
+ EXPECT_EQ(CString("<null>"), printedString(CString()));
+ EXPECT_EQ(CString("\"abc\""), printedString("abc"));
+ EXPECT_EQ(CString("\"\\t\\n\\r\\\"\\\\\""), printedString("\t\n\r\"\\"));
+ EXPECT_EQ(CString("\"\\xFF\\x00\\x01\""), printedString(CString("\xff\0\x01", 3)));
tyoshino (SeeGerritForStatus) 2016/08/12 05:57:38 using CString also for the expectation side to che
tkent 2016/08/12 06:34:54 It isn't so meaningful. I thought returning char*
tyoshino (SeeGerritForStatus) 2016/08/12 06:38:30 Acknowledged.
+}
+
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/text/CString.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698