Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/RefPtrTest.cpp |
| diff --git a/third_party/WebKit/Source/wtf/RefPtrTest.cpp b/third_party/WebKit/Source/wtf/RefPtrTest.cpp |
| index e823520ef3d932f78a224807c6e501ac6f25c0f6..9e0975a3ecb94720d8068926820d4760c9361378 100644 |
| --- a/third_party/WebKit/Source/wtf/RefPtrTest.cpp |
| +++ b/third_party/WebKit/Source/wtf/RefPtrTest.cpp |
| @@ -19,6 +19,19 @@ TEST(RefPtrTest, Basic) { |
| EXPECT_TRUE(!string); |
| } |
| +TEST(RefPtrTest, LeakRef) { |
| + RefPtr<StringImpl> string = StringImpl::create("test"); |
| + EXPECT_TRUE(string); |
| + EXPECT_TRUE(string->hasOneRef()); |
| + StringImpl* raw = string.get(); |
| + StringImpl* leaked = string.leakRef(); |
| + EXPECT_TRUE(!string); |
| + EXPECT_TRUE(leaked); |
| + EXPECT_TRUE(leaked->hasOneRef()); |
| + EXPECT_EQ(raw, leaked); |
| + leaked->deref(); |
|
Bugs Nash
2017/02/20 01:53:38
Needed to add this line to prevent memory leak whi
|
| +} |
| + |
| TEST(RefPtrTest, MoveAssignmentOperator) { |
| RefPtr<StringImpl> a = StringImpl::create("a"); |
| RefPtr<StringImpl> b = StringImpl::create("b"); |