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

Unified Diff: base/security_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/rand_util_unittest.cc ('k') | base/sequence_checker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/security_unittest.cc
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index 39ccdf5817734d0f3a4238b6927787f3db3bb638..c39864e29874b50da64b20252e6b990f7c5bf00b 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -12,11 +12,11 @@
#include <algorithm>
#include <limits>
+#include <memory>
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/free_deleter.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -110,8 +110,8 @@ TEST(SecurityTest, MAYBE_NewOverflow) {
const size_t kArraySize2 = kMaxSizeT / kArraySize + 10;
const size_t kDynamicArraySize2 = HideValueFromCompiler(kArraySize2);
{
- scoped_ptr<char[][kArraySize]> array_pointer(new (nothrow)
- char[kDynamicArraySize2][kArraySize]);
+ std::unique_ptr<char[][kArraySize]> array_pointer(
+ new (nothrow) char[kDynamicArraySize2][kArraySize]);
OverflowTestsSoftExpectTrue(!array_pointer);
}
// On windows, the compiler prevents static array sizes of more than
@@ -120,8 +120,8 @@ TEST(SecurityTest, MAYBE_NewOverflow) {
ALLOW_UNUSED_LOCAL(kDynamicArraySize);
#else
{
- scoped_ptr<char[][kArraySize2]> array_pointer(new (nothrow)
- char[kDynamicArraySize][kArraySize2]);
+ std::unique_ptr<char[][kArraySize2]> array_pointer(
+ new (nothrow) char[kDynamicArraySize][kArraySize2]);
OverflowTestsSoftExpectTrue(!array_pointer);
}
#endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS)
@@ -157,7 +157,7 @@ TEST(SecurityTest, MALLOC_OVERFLOW_TEST(RandomMemoryAllocations)) {
// 1 MB should get us past what TCMalloc pre-allocated before initializing
// the sophisticated allocators.
size_t kAllocSize = 1<<20;
- scoped_ptr<char, base::FreeDeleter> ptr(
+ std::unique_ptr<char, base::FreeDeleter> ptr(
static_cast<char*>(malloc(kAllocSize)));
ASSERT_TRUE(ptr != NULL);
// If two pointers are separated by less than 512MB, they are considered
« no previous file with comments | « base/rand_util_unittest.cc ('k') | base/sequence_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698