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

Unified Diff: base/memory/weak_ptr_unittest.cc

Issue 7065030: Add missing test to WeakPtr (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/weak_ptr_unittest.cc
===================================================================
--- base/memory/weak_ptr_unittest.cc (revision 85147)
+++ base/memory/weak_ptr_unittest.cc (working copy)
@@ -80,6 +80,20 @@
EXPECT_TRUE(b.get() == NULL);
}
+TEST(WeakPtrTest, MultipleStaged) {
+ WeakPtr<int> a;
+ {
+ int data;
+ WeakPtrFactory<int> factory(&data);
+ a = factory.GetWeakPtr();
+ {
+ WeakPtr<int> b = factory.GetWeakPtr();
willchan no longer on Chromium 2011/05/24 22:29:24 Maybe you should also add EXPECTs for b? Up to you
+ }
+ EXPECT_TRUE(a.get() != NULL);
+ }
+ EXPECT_TRUE(a.get() == NULL);
+}
+
TEST(WeakPtrTest, UpCast) {
Derived data;
WeakPtrFactory<Derived> factory(&data);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698