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

Unified Diff: base/containers/scoped_ptr_hash_map_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/containers/scoped_ptr_hash_map.h ('k') | base/debug/asan_invalid_access.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/containers/scoped_ptr_hash_map_unittest.cc
diff --git a/base/containers/scoped_ptr_hash_map_unittest.cc b/base/containers/scoped_ptr_hash_map_unittest.cc
index 38fc91a3840967086d3515d94cc38e0d453613bc..eddabafd2f6cff160bdedd212d0be89a2f11dcfe 100644
--- a/base/containers/scoped_ptr_hash_map_unittest.cc
+++ b/base/containers/scoped_ptr_hash_map_unittest.cc
@@ -4,7 +4,9 @@
#include "base/containers/scoped_ptr_hash_map.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -56,8 +58,9 @@ TEST(ScopedPtrHashMapTest, CustomDeleter) {
DeleteCounter::ResetCounter();
CountingDeleter::ResetCounter();
{
- ScopedPtrHashMap<int, scoped_ptr<DeleteCounter, CountingDeleter>> map;
- map.set(key, scoped_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
+ ScopedPtrHashMap<int, std::unique_ptr<DeleteCounter, CountingDeleter>> map;
+ map.set(key,
+ std::unique_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
}
EXPECT_EQ(1, DeleteCounter::delete_count());
EXPECT_EQ(1, CountingDeleter::count());
@@ -66,9 +69,9 @@ TEST(ScopedPtrHashMapTest, CustomDeleter) {
DeleteCounter::ResetCounter();
CountingDeleter::ResetCounter();
{
- ScopedPtrHashMap<int, scoped_ptr<DeleteCounter, CountingDeleter>> map;
- map.erase(map.set(
- key, scoped_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter)));
+ ScopedPtrHashMap<int, std::unique_ptr<DeleteCounter, CountingDeleter>> map;
+ map.erase(map.set(key, std::unique_ptr<DeleteCounter, CountingDeleter>(
+ new DeleteCounter)));
EXPECT_EQ(1, DeleteCounter::delete_count());
EXPECT_EQ(1, CountingDeleter::count());
}
@@ -79,10 +82,13 @@ TEST(ScopedPtrHashMapTest, CustomDeleter) {
DeleteCounter::ResetCounter();
CountingDeleter::ResetCounter();
{
- ScopedPtrHashMap<int, scoped_ptr<DeleteCounter, CountingDeleter>> map;
- map.set(key, scoped_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
- map.set(key, scoped_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
- map.set(key, scoped_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
+ ScopedPtrHashMap<int, std::unique_ptr<DeleteCounter, CountingDeleter>> map;
+ map.set(key,
+ std::unique_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
+ map.set(key,
+ std::unique_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
+ map.set(key,
+ std::unique_ptr<DeleteCounter, CountingDeleter>(new DeleteCounter));
EXPECT_EQ(2, DeleteCounter::delete_count());
EXPECT_EQ(2, CountingDeleter::count());
}
@@ -93,9 +99,9 @@ TEST(ScopedPtrHashMapTest, CustomDeleter) {
// Test that using a value type from a namespace containing an ignore_result
// function compiles correctly.
TEST(ScopedPtrHashMapTest, IgnoreResultCompile) {
- ScopedPtrHashMap<int, scoped_ptr<namespace_with_ignore_result::Value>>
+ ScopedPtrHashMap<int, std::unique_ptr<namespace_with_ignore_result::Value>>
scoped_map;
- scoped_map.add(1, make_scoped_ptr(new namespace_with_ignore_result::Value));
+ scoped_map.add(1, WrapUnique(new namespace_with_ignore_result::Value));
}
} // namespace
« no previous file with comments | « base/containers/scoped_ptr_hash_map.h ('k') | base/debug/asan_invalid_access.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698