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

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

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // changes are: 59 // changes are:
60 // INITIAL -> CONSTRUCTED -> DESTROYED. 60 // INITIAL -> CONSTRUCTED -> DESTROYED.
61 // Anything more complicated than that should start another test. 61 // Anything more complicated than that should start another test.
62 class LifeCycleWatcher : public LifeCycleObject::Observer { 62 class LifeCycleWatcher : public LifeCycleObject::Observer {
63 public: 63 public:
64 LifeCycleWatcher() : life_cycle_state_(LC_INITIAL) {} 64 LifeCycleWatcher() : life_cycle_state_(LC_INITIAL) {}
65 virtual ~LifeCycleWatcher() {} 65 virtual ~LifeCycleWatcher() {}
66 66
67 // Assert INITIAL -> CONSTRUCTED and no LifeCycleObject associated with this 67 // Assert INITIAL -> CONSTRUCTED and no LifeCycleObject associated with this
68 // LifeCycleWatcher. 68 // LifeCycleWatcher.
69 virtual void OnLifeCycleConstruct(LifeCycleObject* object) OVERRIDE { 69 void OnLifeCycleConstruct(LifeCycleObject* object) override {
70 ASSERT_EQ(LC_INITIAL, life_cycle_state_); 70 ASSERT_EQ(LC_INITIAL, life_cycle_state_);
71 ASSERT_EQ(NULL, constructed_life_cycle_object_.get()); 71 ASSERT_EQ(NULL, constructed_life_cycle_object_.get());
72 life_cycle_state_ = LC_CONSTRUCTED; 72 life_cycle_state_ = LC_CONSTRUCTED;
73 constructed_life_cycle_object_.reset(object); 73 constructed_life_cycle_object_.reset(object);
74 } 74 }
75 75
76 // Assert CONSTRUCTED -> DESTROYED and the |object| being destroyed is the 76 // Assert CONSTRUCTED -> DESTROYED and the |object| being destroyed is the
77 // same one we saw constructed. 77 // same one we saw constructed.
78 virtual void OnLifeCycleDestroy(LifeCycleObject* object) OVERRIDE { 78 void OnLifeCycleDestroy(LifeCycleObject* object) override {
79 ASSERT_EQ(LC_CONSTRUCTED, life_cycle_state_); 79 ASSERT_EQ(LC_CONSTRUCTED, life_cycle_state_);
80 LifeCycleObject* constructed_life_cycle_object = 80 LifeCycleObject* constructed_life_cycle_object =
81 constructed_life_cycle_object_.release(); 81 constructed_life_cycle_object_.release();
82 ASSERT_EQ(constructed_life_cycle_object, object); 82 ASSERT_EQ(constructed_life_cycle_object, object);
83 life_cycle_state_ = LC_DESTROYED; 83 life_cycle_state_ = LC_DESTROYED;
84 } 84 }
85 85
86 LifeCycleState life_cycle_state() const { return life_cycle_state_; } 86 LifeCycleState life_cycle_state() const { return life_cycle_state_; }
87 87
88 // Factory method for creating a new LifeCycleObject tied to this 88 // Factory method for creating a new LifeCycleObject tied to this
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } // namespace 311 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698