From 53b3f1c274546ad7517a27e17bdde3d4a79829e7 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 14 Nov 2016 13:28:05 -0500 Subject: [PATCH] Remove usage of base::StringPrintf in unit tests (issue #1632) --- tests/unittests/message_router_unittest.cc | 40 ++++++++++++--------- tests/unittests/request_handler_unittest.cc | 14 ++++---- tests/unittests/urlrequest_unittest.cc | 11 +++--- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/tests/unittests/message_router_unittest.cc b/tests/unittests/message_router_unittest.cc index 539018447..d605e80d0 100644 --- a/tests/unittests/message_router_unittest.cc +++ b/tests/unittests/message_router_unittest.cc @@ -4,10 +4,9 @@ #include #include +#include #include -#include "base/strings/stringprintf.h" - #include "include/base/cef_bind.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_v8.h" @@ -94,11 +93,10 @@ class MRRenderDelegate : public ClientAppRenderer::Delegate { } if (expected_count != actual_count) { - const std::string& exceptionStr = - base::StringPrintf("%s failed; expected %d, got %d", - message_name.c_str(), expected_count, - actual_count); - exception = exceptionStr; + std::stringstream ss; + ss << message_name << " failed; expected " << expected_count << + ", got " << actual_count; + exception = ss.str(); } } @@ -439,8 +437,9 @@ class SingleQueryTestHandler : public SingleLoadTestHandler { std::string GetMainHTML() override { std::string html; - const std::string& errorCodeStr = - base::StringPrintf("%d", kSingleQueryErrorCode); + std::stringstream ss; + ss << kSingleQueryErrorCode; + const std::string& errorCodeStr = ss.str(); html = "