http://codereview.appspot.com/4233041/

Add templated version of SkAutoTUnref.
Add unittests for it.
Remove unused helper apis on SkAutoUnref.



git-svn-id: http://skia.googlecode.com/svn/trunk@858 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index 8ec063e..1e11bdc 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -43,6 +43,27 @@
     r0->unref();
 }
 
+static void test_autounref(skiatest::Reporter* reporter) {
+    RefClass obj(0);
+    REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
+
+    SkAutoTUnref<RefClass> tmp(&obj);
+    REPORTER_ASSERT(reporter, &obj == tmp.get());
+    REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
+
+    REPORTER_ASSERT(reporter, &obj == tmp.detach());
+    REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
+    REPORTER_ASSERT(reporter, NULL == tmp.detach());
+    REPORTER_ASSERT(reporter, NULL == tmp.get());
+
+    obj.ref();
+    REPORTER_ASSERT(reporter, 2 == obj.getRefCnt());
+    {
+        SkAutoTUnref<RefClass> tmp2(&obj);
+    }
+    REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #define kSEARCH_COUNT   91
@@ -145,7 +166,8 @@
     test_utf16(reporter);
     test_search(reporter);
     test_refptr(reporter);
+    test_autounref(reporter);
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("UTF", UtfTestClass, TestUTF)
+DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF)