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

Unified Diff: base/strings/safe_sprintf_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/sequence_checker_unittest.cc ('k') | base/strings/utf_offset_string_conversions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/safe_sprintf_unittest.cc
diff --git a/base/strings/safe_sprintf_unittest.cc b/base/strings/safe_sprintf_unittest.cc
index 931ace8b12453e2b7f4b54182d0f5c245947ed4f..1a21728a8e5f0e6298338ca5919be95fe20a0fc1 100644
--- a/base/strings/safe_sprintf_unittest.cc
+++ b/base/strings/safe_sprintf_unittest.cc
@@ -10,10 +10,10 @@
#include <string.h>
#include <limits>
+#include <memory>
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -205,7 +205,7 @@ TEST(SafeSPrintfTest, ASANFriendlyBufferTest) {
// There is a more complicated test in PrintLongString() that covers a lot
// more edge case, but it is also harder to debug in case of a failure.
const char kTestString[] = "This is a test";
- scoped_ptr<char[]> buf(new char[sizeof(kTestString)]);
+ std::unique_ptr<char[]> buf(new char[sizeof(kTestString)]);
EXPECT_EQ(static_cast<ssize_t>(sizeof(kTestString) - 1),
SafeSNPrintf(buf.get(), sizeof(kTestString), kTestString));
EXPECT_EQ(std::string(kTestString), std::string(buf.get()));
@@ -369,7 +369,7 @@ void PrintLongString(char* buf, size_t sz) {
// Allocate slightly more space, so that we can verify that SafeSPrintf()
// never writes past the end of the buffer.
- scoped_ptr<char[]> tmp(new char[sz+2]);
+ std::unique_ptr<char[]> tmp(new char[sz + 2]);
memset(tmp.get(), 'X', sz+2);
// Use SafeSPrintf() to output a complex list of arguments:
@@ -383,7 +383,7 @@ void PrintLongString(char* buf, size_t sz) {
char* out = tmp.get();
size_t out_sz = sz;
size_t len;
- for (scoped_ptr<char[]> perfect_buf;;) {
+ for (std::unique_ptr<char[]> perfect_buf;;) {
size_t needed = SafeSNPrintf(out, out_sz,
#if defined(NDEBUG)
"A%2cong %s: %d %010X %d %p%7s", 'l', "string", "",
« no previous file with comments | « base/sequence_checker_unittest.cc ('k') | base/strings/utf_offset_string_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698