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

Side by Side Diff: base/memory/scoped_vector_unittest.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 "base/memory/scoped_vector.h" 5 #include "base/memory/scoped_vector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 for(LifeCycleWatcher* it = watchers; it != watchers + 1; ++it) 302 for(LifeCycleWatcher* it = watchers; it != watchers + 1; ++it)
303 EXPECT_EQ(LC_CONSTRUCTED, it->life_cycle_state()); 303 EXPECT_EQ(LC_CONSTRUCTED, it->life_cycle_state());
304 for(LifeCycleWatcher* it = watchers + 1; it != watchers + 3; ++it) 304 for(LifeCycleWatcher* it = watchers + 1; it != watchers + 3; ++it)
305 EXPECT_EQ(LC_DESTROYED, it->life_cycle_state()); 305 EXPECT_EQ(LC_DESTROYED, it->life_cycle_state());
306 for(LifeCycleWatcher* it = watchers + 3; it != watchers + arraysize(watchers); 306 for(LifeCycleWatcher* it = watchers + 3; it != watchers + arraysize(watchers);
307 ++it) 307 ++it)
308 EXPECT_EQ(LC_CONSTRUCTED, it->life_cycle_state()); 308 EXPECT_EQ(LC_CONSTRUCTED, it->life_cycle_state());
309 } 309 }
310 310
311 // Assertions for push_back(scoped_ptr).
312 TEST(ScopedVectorTest, PushBackScopedPtr) {
313 int delete_counter = 0;
314 scoped_ptr<DeleteCounter> elem(new DeleteCounter(&delete_counter));
315 EXPECT_EQ(0, delete_counter);
316 {
317 ScopedVector<DeleteCounter> v;
318 v.push_back(elem.Pass());
319 EXPECT_EQ(0, delete_counter);
320 }
321 EXPECT_EQ(1, delete_counter);
322 }
323
311 } // namespace 324 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698