diff options
author | tsepez <tsepez@chromium.org> | 2016-11-29 14:56:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-29 14:56:36 -0800 |
commit | b90c71a7b8530c5bd15740d0bb680f097920cd65 (patch) | |
tree | 3cd3ff98a634e8cfb488e332e2fb7f9d16e3c4f8 /core/fxcrt/cfx_retain_ptr_unittest.cpp | |
parent | f11380fc01cc17f05a34859d34c42b495c8ef8be (diff) | |
download | pdfium-b90c71a7b8530c5bd15740d0bb680f097920cd65.tar.xz |
Add pdfium::MakeRetain<>() helper function.
Part of the work to get rid of |new|s. Stripped from a forthcoming CL.
Review-Url: https://codereview.chromium.org/2536973003
Diffstat (limited to 'core/fxcrt/cfx_retain_ptr_unittest.cpp')
-rw-r--r-- | core/fxcrt/cfx_retain_ptr_unittest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_retain_ptr_unittest.cpp b/core/fxcrt/cfx_retain_ptr_unittest.cpp index aa92e57f32..692beb82ff 100644 --- a/core/fxcrt/cfx_retain_ptr_unittest.cpp +++ b/core/fxcrt/cfx_retain_ptr_unittest.cpp @@ -213,3 +213,13 @@ TEST(fxcrt, RetainPtrBool) { EXPECT_FALSE(null_bool); EXPECT_TRUE(obj1_bool); } + +TEST(fxcrt, RetainPtrMakeRetained) { + auto ptr = pdfium::MakeRetain<CFX_Retainable>(); + EXPECT_TRUE(ptr->HasOneRef()); + { + CFX_RetainPtr<CFX_Retainable> other = ptr; + EXPECT_FALSE(ptr->HasOneRef()); + } + EXPECT_TRUE(ptr->HasOneRef()); +} |