diff options
Diffstat (limited to 'base/weak_ptr_unittest.cc')
-rw-r--r-- | base/weak_ptr_unittest.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/weak_ptr_unittest.cc b/base/weak_ptr_unittest.cc index 80c277b..4f53358 100644 --- a/base/weak_ptr_unittest.cc +++ b/base/weak_ptr_unittest.cc @@ -96,8 +96,20 @@ TEST(WeakPtrTest, InvalidateWeakPtrs) { WeakPtrFactory<int> factory(&data); WeakPtr<int> ptr = factory.GetWeakPtr(); EXPECT_EQ(&data, ptr.get()); + EXPECT_TRUE(factory.HasWeakPtrs()); factory.InvalidateWeakPtrs(); EXPECT_EQ(NULL, ptr.get()); + EXPECT_FALSE(factory.HasWeakPtrs()); +} + +TEST(WeakPtrTest, HasWeakPtrs) { + int data; + WeakPtrFactory<int> factory(&data); + { + WeakPtr<int> ptr = factory.GetWeakPtr(); + EXPECT_TRUE(factory.HasWeakPtrs()); + } + EXPECT_FALSE(factory.HasWeakPtrs()); } TEST(WeakPtrTest, SingleThreaded1) { |