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

Side by Side Diff: ui/base/models/list_model_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 unified diff | Download patch
« no previous file with comments | « ui/base/models/list_model.h ('k') | ui/base/models/tree_node_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/base/models/list_model.h" 5 #include "ui/base/models/list_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 class FooItem { 17 class FooItem {
17 public: 18 public:
18 explicit FooItem(int id) : id_(id) {} 19 explicit FooItem(int id) : id_(id) {}
19 20
20 int id() const { return id_; } 21 int id() const { return id_; }
21 22
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 117
117 // Remove all items from model and delete them. 118 // Remove all items from model and delete them.
118 model.DeleteAll(); 119 model.DeleteAll();
119 ExpectCountsEqual(0, 3, 0, 0); 120 ExpectCountsEqual(0, 3, 0, 0);
120 } 121 }
121 122
122 TEST_F(ListModelTest, RemoveAll) { 123 TEST_F(ListModelTest, RemoveAll) {
123 ListModel<FooItem> model; 124 ListModel<FooItem> model;
124 model.AddObserver(this); 125 model.AddObserver(this);
125 126
126 scoped_ptr<FooItem> foo0(new FooItem(0)); 127 std::unique_ptr<FooItem> foo0(new FooItem(0));
127 scoped_ptr<FooItem> foo1(new FooItem(1)); 128 std::unique_ptr<FooItem> foo1(new FooItem(1));
128 scoped_ptr<FooItem> foo2(new FooItem(2)); 129 std::unique_ptr<FooItem> foo2(new FooItem(2));
129 130
130 model.Add(foo0.get()); 131 model.Add(foo0.get());
131 model.Add(foo1.get()); 132 model.Add(foo1.get());
132 model.Add(foo2.get()); 133 model.Add(foo2.get());
133 134
134 ClearCounts(); 135 ClearCounts();
135 136
136 // Remove all items and scoped_ptr above would release memory. 137 // Remove all items and scoped_ptr above would release memory.
137 model.RemoveAll(); 138 model.RemoveAll();
138 ExpectCountsEqual(0, 3, 0, 0); 139 ExpectCountsEqual(0, 3, 0, 0);
(...skipping 28 matching lines...) Expand all
167 ClearCounts(); 168 ClearCounts();
168 169
169 model.NotifyItemsChanged(0, 1); 170 model.NotifyItemsChanged(0, 1);
170 ExpectCountsEqual(0, 0, 0, 1); 171 ExpectCountsEqual(0, 0, 0, 1);
171 172
172 model.NotifyItemsChanged(1, 2); 173 model.NotifyItemsChanged(1, 2);
173 ExpectCountsEqual(0, 0, 0, 3); 174 ExpectCountsEqual(0, 0, 0, 3);
174 } 175 }
175 176
176 } // namespace ui 177 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/models/list_model.h ('k') | ui/base/models/tree_node_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698