Add sk_ref_sp helper function.
Review URL: https://codereview.chromium.org/1773943004
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index 2932913..a9b461f 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -385,3 +385,16 @@
sp.reset(rc); // this should transfer our ownership over to sp
REPORTER_ASSERT(r, rc->unique());
}
+
+DEF_TEST(sk_sp_ref, r) {
+ SkRefCnt* rc = new SkRefCnt;
+ REPORTER_ASSERT(r, rc->unique());
+
+ {
+ sk_sp<SkRefCnt> sp = sk_ref_sp(rc);
+ REPORTER_ASSERT(r, !rc->unique());
+ }
+
+ REPORTER_ASSERT(r, rc->unique());
+ rc->unref();
+}