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

Unified Diff: core/fxcrt/cfx_retain_ptr_unittest.cpp

Issue 2536973003: Add pdfium::MakeRetain<>() helper function. (Closed)
Patch Set: Another test Created 4 years, 1 month 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 | « core/fxcrt/cfx_retain_ptr.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/cfx_retain_ptr_unittest.cpp
diff --git a/core/fxcrt/cfx_retain_ptr_unittest.cpp b/core/fxcrt/cfx_retain_ptr_unittest.cpp
index aa92e57f32fb87e2d7702af4e06c8637385052f5..692beb82ffdf3eadd21d408007a2617ea31a5d85 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());
+}
« no previous file with comments | « core/fxcrt/cfx_retain_ptr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698