Index: base/memory/scoped_vector_unittest.cc |
diff --git a/base/memory/scoped_vector_unittest.cc b/base/memory/scoped_vector_unittest.cc |
index 03774c52a6c2039ed4f580ad4df486a4bb2c14db..e9b609add0e1d6ac076a89de07ff459e3ffc9867 100644 |
--- a/base/memory/scoped_vector_unittest.cc |
+++ b/base/memory/scoped_vector_unittest.cc |
@@ -14,6 +14,13 @@ namespace { |
// The LifeCycleObject notifies its Observer upon construction & destruction. |
class LifeCycleObject { |
public: |
+ ~LifeCycleObject() { |
+ observer_->OnLifeCycleDestroy(this); |
+ } |
+ |
+ private: |
+ friend class LifeCycleWatcher; |
+ |
class Observer { |
public: |
virtual void OnLifeCycleConstruct(LifeCycleObject* o) = 0; |
@@ -28,11 +35,6 @@ class LifeCycleObject { |
observer_->OnLifeCycleConstruct(this); |
} |
- ~LifeCycleObject() { |
- observer_->OnLifeCycleDestroy(this); |
- } |
- |
- private: |
Observer* observer_; |
DISALLOW_COPY_AND_ASSIGN(LifeCycleObject); |
@@ -115,19 +117,18 @@ TEST(ScopedVectorTest, Clear) { |
EXPECT_EQ(LC_CONSTRUCTED, watcher.life_cycle_state()); |
scoped_vector.clear(); |
EXPECT_EQ(LC_DESTROYED, watcher.life_cycle_state()); |
- EXPECT_EQ(static_cast<size_t>(0), scoped_vector.size()); |
+ EXPECT_TRUE(scoped_vector.empty()); |
gavinp
2012/11/24 14:27:18
And actually, no need for any cast at all here.
|
} |
TEST(ScopedVectorTest, WeakClear) { |
LifeCycleWatcher watcher; |
EXPECT_EQ(LC_INITIAL, watcher.life_cycle_state()); |
ScopedVector<LifeCycleObject> scoped_vector; |
- scoped_ptr<LifeCycleObject> object(watcher.NewLifeCycleObject()); |
- scoped_vector.push_back(object.get()); |
+ scoped_vector.push_back(watcher.NewLifeCycleObject()); |
EXPECT_EQ(LC_CONSTRUCTED, watcher.life_cycle_state()); |
scoped_vector.weak_clear(); |
EXPECT_EQ(LC_CONSTRUCTED, watcher.life_cycle_state()); |
- EXPECT_EQ(static_cast<size_t>(0), scoped_vector.size()); |
+ EXPECT_TRUE(scoped_vector.empty()); |
} |
TEST(ScopedVectorTest, Scope) { |