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

Side by Side Diff: content/browser/indexed_db/list_set_unittest.cc

Issue 2233153002: IndexedDB: WrapUnique(new T(args..)) -> MakeUnique<T>(args...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/list_set.h" 5 #include "content/browser/indexed_db/list_set.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 TEST(ListSetTest, ListSetIterator) { 15 TEST(ListSetTest, ListSetIterator) {
15 list_set<int> set; 16 list_set<int> set;
16 for (int i = 3; i > 0; --i) 17 for (int i = 3; i > 0; --i)
17 set.insert(i); 18 set.insert(i);
18 19
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 set.erase(Wrapped<int>(2)); 142 set.erase(Wrapped<int>(2));
142 143
143 EXPECT_EQ(0u, set.size()); 144 EXPECT_EQ(0u, set.size());
144 { 145 {
145 list_set<Wrapped<int> >::iterator it = set.begin(); 146 list_set<Wrapped<int> >::iterator it = set.begin();
146 EXPECT_EQ(set.end(), it); 147 EXPECT_EQ(set.end(), it);
147 } 148 }
148 } 149 }
149 150
150 TEST(ListSetTest, ListSetPointer) { 151 TEST(ListSetTest, ListSetPointer) {
151 std::unique_ptr<Wrapped<int>> w0(new Wrapped<int>(0)); 152 std::unique_ptr<Wrapped<int>> w0 = base::MakeUnique<Wrapped<int>>(0);
152 std::unique_ptr<Wrapped<int>> w1(new Wrapped<int>(1)); 153 std::unique_ptr<Wrapped<int>> w1 = base::MakeUnique<Wrapped<int>>(1);
153 std::unique_ptr<Wrapped<int>> w2(new Wrapped<int>(2)); 154 std::unique_ptr<Wrapped<int>> w2 = base::MakeUnique<Wrapped<int>>(2);
154 155
155 list_set<Wrapped<int>*> set; 156 list_set<Wrapped<int>*> set;
156 EXPECT_EQ(0u, set.size()); 157 EXPECT_EQ(0u, set.size());
157 { 158 {
158 list_set<Wrapped<int>*>::iterator it = set.begin(); 159 list_set<Wrapped<int>*>::iterator it = set.begin();
159 EXPECT_EQ(set.end(), it); 160 EXPECT_EQ(set.end(), it);
160 } 161 }
161 162
162 set.insert(w0.get()); 163 set.insert(w0.get());
163 set.insert(w1.get()); 164 set.insert(w1.get());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 set.erase(r2); 234 set.erase(r2);
234 235
235 EXPECT_EQ(0u, set.size()); 236 EXPECT_EQ(0u, set.size());
236 { 237 {
237 list_set<scoped_refptr<RefCounted<int> > >::iterator it = set.begin(); 238 list_set<scoped_refptr<RefCounted<int> > >::iterator it = set.begin();
238 EXPECT_EQ(set.end(), it); 239 EXPECT_EQ(set.end(), it);
239 } 240 }
240 } 241 }
241 242
242 } // namespace content 243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698