tests: s/SkAutoTUnref/sk_sp/

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4394

Change-Id: I088b3c6e2adff07abed1e8a50091cc0ec4a4109c
Reviewed-on: https://skia-review.googlesource.com/4394
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 4ecc934..2893a0c 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -281,8 +281,8 @@
     desc.fHeight = 30;
     desc.fSampleCnt = 0;
 
-    SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0));
-    SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice  (grContext, texture.get()));
+    sk_sp<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0));
+    sk_sp<SkGpuDevice> device(new SkGpuDevice(grContext, texture.get()));
     SkCanvas canvas(device.get());
 
     blur_path(&canvas, path, gaussianSigma);
diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp
index 2502480..b2d4785 100644
--- a/tests/CachedDataTest.cpp
+++ b/tests/CachedDataTest.cpp
@@ -72,7 +72,7 @@
  *  and when the cache is.
  */
 DEF_TEST(CachedData, reporter) {
-    SkAutoTUnref<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1000));
+    sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1000));
 
     for (int useDiscardable = 0; useDiscardable <= 1; ++useDiscardable) {
         const size_t size = 100;
diff --git a/tests/CodecPriv.h b/tests/CodecPriv.h
index e9ea242..515dbde 100644
--- a/tests/CodecPriv.h
+++ b/tests/CodecPriv.h
@@ -16,7 +16,7 @@
     }
 
     // Construct a color table for the decode if necessary
-    SkAutoTUnref<SkColorTable> colorTable(nullptr);
+    sk_sp<SkColorTable> colorTable(nullptr);
     SkPMColor* colorPtr = nullptr;
     int* colorCountPtr = nullptr;
     int maxColors = 256;
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index c8b573a..32ad9596 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -1091,7 +1091,7 @@
 static void check_round_trip(skiatest::Reporter* r, SkCodec* origCodec, const SkImageInfo& info) {
     SkBitmap bm1;
     SkPMColor colors[256];
-    SkAutoTUnref<SkColorTable> colorTable1(new SkColorTable(colors, 256));
+    sk_sp<SkColorTable> colorTable1(new SkColorTable(colors, 256));
     bm1.allocPixels(info, nullptr, colorTable1.get());
     int numColors;
     SkCodec::Result result = origCodec->getPixels(info, bm1.getPixels(), bm1.rowBytes(), nullptr,
@@ -1109,7 +1109,7 @@
     REPORTER_ASSERT(r, alpha_type_match(info.alphaType(), codec->getInfo().alphaType()));
 
     SkBitmap bm2;
-    SkAutoTUnref<SkColorTable> colorTable2(new SkColorTable(colors, 256));
+    sk_sp<SkColorTable> colorTable2(new SkColorTable(colors, 256));
     bm2.allocPixels(info, nullptr, colorTable2.get());
     result = codec->getPixels(info, bm2.getPixels(), bm2.rowBytes(), nullptr,
                               const_cast<SkPMColor*>(colorTable2->readColors()), &numColors);
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index 540d013..053b456 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -68,11 +68,11 @@
                             dstDesc.fOrigin = dOrigin;
                             dstDesc.fFlags = dFlags;
 
-                            SkAutoTUnref<GrTexture> src(
+                            sk_sp<GrTexture> src(
                                 context->textureProvider()->createTexture(srcDesc, SkBudgeted::kNo,
                                                                           srcPixels.get(),
                                                                           kRowBytes));
-                            SkAutoTUnref<GrTexture> dst(
+                            sk_sp<GrTexture> dst(
                                 context->textureProvider()->createTexture(dstDesc, SkBudgeted::kNo,
                                                                           dstPixels.get(),
                                                                           kRowBytes));
@@ -82,7 +82,8 @@
                                 continue;
                             }
 
-                            bool result = context->copySurface(dst, src, srcRect, dstPoint);
+                            bool result
+                                    = context->copySurface(dst.get(), src.get(), srcRect, dstPoint);
 
                             bool expectedResult = true;
                             SkIPoint dstOffset = { dstPoint.fX - srcRect.fLeft,
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 72bad6f..ab33d8c 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -339,8 +339,8 @@
     SkRWBuffer buffer;
     buffer.append(gABC, 26);
 
-    SkAutoTUnref<SkROBuffer> roBuffer(buffer.newRBufferSnapshot());
-    SkROBuffer::Iter iter(roBuffer);
+    sk_sp<SkROBuffer> roBuffer(buffer.newRBufferSnapshot());
+    SkROBuffer::Iter iter(roBuffer.get());
     REPORTER_ASSERT(r, iter.data());
     REPORTER_ASSERT(r, iter.size() == 26);
 
diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp
index f7d855a..34140a7 100644
--- a/tests/DeviceTest.cpp
+++ b/tests/DeviceTest.cpp
@@ -38,7 +38,7 @@
 
     SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight);
 
-    SkAutoTUnref<SkBaseDevice> bmDev(SkBitmapDevice::Create(ii));
+    sk_sp<SkBaseDevice> bmDev(SkBitmapDevice::Create(ii));
 
     SkBitmap bm;
     bm.tryAllocN32Pixels(kWidth, kHeight);
diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp
index d1ba38a..79b257d 100644
--- a/tests/DiscardableMemoryPoolTest.cpp
+++ b/tests/DiscardableMemoryPoolTest.cpp
@@ -9,7 +9,7 @@
 #include "Test.h"
 
 DEF_TEST(DiscardableMemoryPool, reporter) {
-    SkAutoTUnref<SkDiscardableMemoryPool> pool(
+    sk_sp<SkDiscardableMemoryPool> pool(
         SkDiscardableMemoryPool::Create(1, nullptr));
     pool->setRAMBudget(3);
     REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 2fbe190..221f0c9 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -32,7 +32,7 @@
 //
 static void test_faulty_pixelref(skiatest::Reporter* reporter) {
     // need a cache, but don't expect to use it, so the budget is not critical
-    SkAutoTUnref<SkDiscardableMemoryPool> pool(
+    sk_sp<SkDiscardableMemoryPool> pool(
         SkDiscardableMemoryPool::Create(10 * 1000, nullptr));
 
     SkBitmap bm;
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index ed23b70..27c9659 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -30,12 +30,12 @@
     auto surface(SkSurface::MakeRasterN32Premul(10, 10));
     SkCanvas* canvas = surface->getCanvas();
 
-    SkAutoTUnref<TestFilter> df(new TestFilter);
+    sk_sp<TestFilter> df(new TestFilter);
 
     REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
 
     canvas->save();
-    canvas->setDrawFilter(df);
+    canvas->setDrawFilter(df.get());
     REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter());
     canvas->restore();
 
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 3d2ee05..6301c51 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -75,10 +75,9 @@
     copyDesc.fWidth = externalTexture->width();
     copyDesc.fHeight = externalTexture->height();
     copyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
-    SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(
-            copyDesc, SkBudgeted::kYes));
-    context->copySurface(copy, externalTexture);
-    test_read_pixels(reporter, context, copy, expectedPixelValues);
+    sk_sp<GrTexture> copy(context->textureProvider()->createTexture(copyDesc, SkBudgeted::kYes));
+    context->copySurface(copy.get(), externalTexture);
+    test_read_pixels(reporter, context, copy.get(), expectedPixelValues);
 }
 
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
diff --git a/tests/FlattenDrawableTest.cpp b/tests/FlattenDrawableTest.cpp
index e70404b..b4a551f 100644
--- a/tests/FlattenDrawableTest.cpp
+++ b/tests/FlattenDrawableTest.cpp
@@ -102,17 +102,17 @@
     {}
 
     void flatten(SkWriteBuffer& buffer) const override {
-        buffer.writeFlattenable(fIntDrawable);
-        buffer.writeFlattenable(fPaintDrawable);
+        buffer.writeFlattenable(fIntDrawable.get());
+        buffer.writeFlattenable(fPaintDrawable.get());
     }
 
     static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer) {
-        SkAutoTUnref<SkFlattenable> intDrawable(
+        sk_sp<SkFlattenable> intDrawable(
                 buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
         SkASSERT(intDrawable);
         SkASSERT(!strcmp("IntDrawable", intDrawable->getTypeName()));
 
-        SkAutoTUnref<SkFlattenable> paintDrawable(
+        sk_sp<SkFlattenable> paintDrawable(
                 buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
         SkASSERT(paintDrawable);
         SkASSERT(!strcmp("PaintDrawable", paintDrawable->getTypeName()));
@@ -123,8 +123,8 @@
 
     Factory getFactory() const override { return CreateProc; }
 
-    IntDrawable* intDrawable() const { return fIntDrawable; }
-    PaintDrawable* paintDrawable() const { return fPaintDrawable; }
+    IntDrawable* intDrawable() const { return fIntDrawable.get(); }
+    PaintDrawable* paintDrawable() const { return fPaintDrawable.get(); }
 
     const char* getTypeName() const override { return "CompoundDrawable"; }
 
@@ -133,8 +133,8 @@
     void onDraw(SkCanvas*) override {}
 
 private:
-    SkAutoTUnref<IntDrawable>   fIntDrawable;
-    SkAutoTUnref<PaintDrawable> fPaintDrawable;
+    sk_sp<IntDrawable>   fIntDrawable;
+    sk_sp<PaintDrawable> fPaintDrawable;
 };
 
 class RootDrawable : public SkDrawable {
@@ -154,23 +154,23 @@
     {}
 
     void flatten(SkWriteBuffer& buffer) const override {
-        buffer.writeFlattenable(fCompoundDrawable);
-        buffer.writeFlattenable(fIntDrawable);
-        buffer.writeFlattenable(fDrawable);
+        buffer.writeFlattenable(fCompoundDrawable.get());
+        buffer.writeFlattenable(fIntDrawable.get());
+        buffer.writeFlattenable(fDrawable.get());
     }
 
     static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer) {
-        SkAutoTUnref<SkFlattenable> compoundDrawable(
+        sk_sp<SkFlattenable> compoundDrawable(
                 buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
         SkASSERT(compoundDrawable);
         SkASSERT(!strcmp("CompoundDrawable", compoundDrawable->getTypeName()));
 
-        SkAutoTUnref<SkFlattenable> intDrawable(
+        sk_sp<SkFlattenable> intDrawable(
                 buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
         SkASSERT(intDrawable);
         SkASSERT(!strcmp("IntDrawable", intDrawable->getTypeName()));
 
-        SkAutoTUnref<SkFlattenable> drawable(
+        sk_sp<SkFlattenable> drawable(
                 buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
         SkASSERT(drawable);
 
@@ -181,9 +181,9 @@
 
     Factory getFactory() const override { return CreateProc; }
 
-    CompoundDrawable* compoundDrawable() const { return fCompoundDrawable; }
-    IntDrawable* intDrawable() const { return fIntDrawable; }
-    SkDrawable* drawable() const { return fDrawable; }
+    CompoundDrawable* compoundDrawable() const { return fCompoundDrawable.get(); }
+    IntDrawable* intDrawable() const { return fIntDrawable.get(); }
+    SkDrawable* drawable() const { return fDrawable.get(); }
 
     const char* getTypeName() const override { return "RootDrawable"; }
 
@@ -192,9 +192,9 @@
     void onDraw(SkCanvas*) override {}
 
 private:
-    SkAutoTUnref<CompoundDrawable> fCompoundDrawable;
-    SkAutoTUnref<IntDrawable>      fIntDrawable;
-    SkAutoTUnref<SkDrawable>       fDrawable;
+    sk_sp<CompoundDrawable> fCompoundDrawable;
+    sk_sp<IntDrawable>      fIntDrawable;
+    sk_sp<SkDrawable>       fDrawable;
 };
 
 static void register_test_drawables(SkReadBuffer& buffer) {
@@ -206,12 +206,12 @@
 
 DEF_TEST(FlattenDrawable, r) {
     // Create and serialize the test drawable
-    SkAutoTUnref<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
+    sk_sp<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
     SkPaint paint;
     paint.setColor(SK_ColorBLUE);
-    SkAutoTUnref<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable));
+    sk_sp<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable.get()));
     SkBinaryWriteBuffer writeBuffer;
-    writeBuffer.writeFlattenable(root);
+    writeBuffer.writeFlattenable(root.get());
 
     // Copy the contents of the write buffer into a read buffer
     sk_sp<SkData> data = SkData::MakeUninitialized(writeBuffer.bytesWritten());
@@ -220,8 +220,7 @@
     register_test_drawables(readBuffer);
 
     // Deserialize and verify the drawable
-    SkAutoTUnref<SkDrawable> out((SkDrawable*)
-            readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
+    sk_sp<SkDrawable> out((SkDrawable*)readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
     REPORTER_ASSERT(r, out);
     REPORTER_ASSERT(r, !strcmp("RootDrawable", out->getTypeName()));
 
@@ -260,13 +259,13 @@
     canvas->drawText("TEXT", 4, 467.0f, 100.0f, textPaint);
 
     // Draw some drawables as well
-    SkAutoTUnref<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
-    SkAutoTUnref<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable));
-    canvas->drawDrawable(root, 747.0f, 242.0f);
-    SkAutoTUnref<PaintDrawable> paintDrawable(new PaintDrawable(paint));
-    canvas->drawDrawable(paintDrawable, 500.0, 500.0f);
-    SkAutoTUnref<CompoundDrawable> comDrawable(new CompoundDrawable(13, 14, 15, 16, textPaint));
-    canvas->drawDrawable(comDrawable, 10.0f, 10.0f);
+    sk_sp<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
+    sk_sp<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable.get()));
+    canvas->drawDrawable(root.get(), 747.0f, 242.0f);
+    sk_sp<PaintDrawable> paintDrawable(new PaintDrawable(paint));
+    canvas->drawDrawable(paintDrawable.get(), 500.0, 500.0f);
+    sk_sp<CompoundDrawable> comDrawable(new CompoundDrawable(13, 14, 15, 16, textPaint));
+    canvas->drawDrawable(comDrawable.get(), 10.0f, 10.0f);
 
     // Serialize the recorded drawable
     sk_sp<SkDrawable> recordedDrawable = recorder.finishRecordingAsDrawable();
@@ -280,8 +279,7 @@
     register_test_drawables(readBuffer);
 
     // Deserialize and verify the drawable
-    SkAutoTUnref<SkDrawable> out((SkDrawable*)
-            readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
+    sk_sp<SkDrawable> out((SkDrawable*)readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
     REPORTER_ASSERT(r, out);
     REPORTER_ASSERT(r, !strcmp("SkRecordedDrawable", out->getTypeName()));
 }
diff --git a/tests/FlattenableCustomFactory.cpp b/tests/FlattenableCustomFactory.cpp
index 567331c..e83311b 100644
--- a/tests/FlattenableCustomFactory.cpp
+++ b/tests/FlattenableCustomFactory.cpp
@@ -53,12 +53,12 @@
 DEF_TEST(UnflattenWithCustomFactory, r) {
     // Create and flatten the test flattenable
     SkBinaryWriteBuffer writeBuffer;
-    SkAutoTUnref<SkFlattenable> flattenable1(new IntFlattenable(1, 2, 3, 4));
-    writeBuffer.writeFlattenable(flattenable1);
-    SkAutoTUnref<SkFlattenable> flattenable2(new IntFlattenable(2, 3, 4, 5));
-    writeBuffer.writeFlattenable(flattenable2);
-    SkAutoTUnref<SkFlattenable> flattenable3(new IntFlattenable(3, 4, 5, 6));
-    writeBuffer.writeFlattenable(flattenable3);
+    sk_sp<SkFlattenable> flattenable1(new IntFlattenable(1, 2, 3, 4));
+    writeBuffer.writeFlattenable(flattenable1.get());
+    sk_sp<SkFlattenable> flattenable2(new IntFlattenable(2, 3, 4, 5));
+    writeBuffer.writeFlattenable(flattenable2.get());
+    sk_sp<SkFlattenable> flattenable3(new IntFlattenable(3, 4, 5, 6));
+    writeBuffer.writeFlattenable(flattenable3.get());
 
     // Copy the contents of the write buffer into a read buffer
     sk_sp<SkData> data = SkData::MakeUninitialized(writeBuffer.bytesWritten());
@@ -69,7 +69,7 @@
     readBuffer.setCustomFactory(SkString("IntFlattenable"), &custom_create_proc);
 
     // Unflatten and verify the flattenables
-    SkAutoTUnref<IntFlattenable> out1((IntFlattenable*) readBuffer.readFlattenable(
+    sk_sp<IntFlattenable> out1((IntFlattenable*) readBuffer.readFlattenable(
             SkFlattenable::kSkUnused_Type));
     REPORTER_ASSERT(r, out1);
     REPORTER_ASSERT(r, 2 == out1->a());
@@ -77,7 +77,7 @@
     REPORTER_ASSERT(r, 4 == out1->c());
     REPORTER_ASSERT(r, 5 == out1->d());
 
-    SkAutoTUnref<IntFlattenable> out2((IntFlattenable*) readBuffer.readFlattenable(
+    sk_sp<IntFlattenable> out2((IntFlattenable*) readBuffer.readFlattenable(
             SkFlattenable::kSkUnused_Type));
     REPORTER_ASSERT(r, out2);
     REPORTER_ASSERT(r, 3 == out2->a());
@@ -85,7 +85,7 @@
     REPORTER_ASSERT(r, 5 == out2->c());
     REPORTER_ASSERT(r, 6 == out2->d());
 
-    SkAutoTUnref<IntFlattenable> out3((IntFlattenable*) readBuffer.readFlattenable(
+    sk_sp<IntFlattenable> out3((IntFlattenable*) readBuffer.readFlattenable(
             SkFlattenable::kSkUnused_Type));
     REPORTER_ASSERT(r, out3);
     REPORTER_ASSERT(r, 4 == out3->a());
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 2e79c35..fe0368d 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -45,7 +45,7 @@
         desc.fConfig = config;
         desc.fOrigin = 0 == origin ?
             kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
-        SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
+        sk_sp<GrTexture> fpTexture(context->textureProvider()->createTexture(
             desc, SkBudgeted::kNo, controlPixelData.begin(), 0));
         // Floating point textures are NOT supported everywhere
         if (nullptr == fpTexture) {
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 172bff3..50e2d5a 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -82,15 +82,15 @@
 }
 
 static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
-    SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+    sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
     int count = fm->countFamilies();
 
     for (int i = 0; i < count; ++i) {
         SkString fname;
         fm->getFamilyName(i, &fname);
 
-        SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
-        SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+        sk_sp<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
+        sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
         REPORTER_ASSERT(reporter, fnset->count() == set->count());
 
         if (verbose) {
@@ -103,7 +103,7 @@
             set->getStyle(j, &fs, &sname);
 //            REPORTER_ASSERT(reporter, sname.size() > 0);
 
-            SkAutoTUnref<SkTypeface> face(set->createTypeface(j));
+            sk_sp<SkTypeface> face(set->createTypeface(j));
 //            REPORTER_ASSERT(reporter, face.get());
 
             if (verbose) {
@@ -691,7 +691,7 @@
 
     for (StyleSetTest& test : tests) {
         for (const StyleSetTest::Case& testCase : test.cases) {
-            SkAutoTUnref<SkTypeface> typeface(test.styleSet.matchStyle(testCase.pattern));
+            sk_sp<SkTypeface> typeface(test.styleSet.matchStyle(testCase.pattern));
             if (typeface) {
                 REPORTER_ASSERT(reporter, typeface->fontStyle() == testCase.expectedResult);
             } else {
diff --git a/tests/FontNamesTest.cpp b/tests/FontNamesTest.cpp
index 5c314e4..e5dce32 100644
--- a/tests/FontNamesTest.cpp
+++ b/tests/FontNamesTest.cpp
@@ -142,16 +142,16 @@
 static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
     static const SkFontTableTag nameTag = SkSetFourByteTag('n','a','m','e');
 
-    SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+    sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
     int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
     for (int i = 0; i < count; ++i) {
-        SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+        sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
         for (int j = 0; j < set->count(); ++j) {
             SkString sname;
             SkFontStyle fs;
             set->getStyle(j, &fs, &sname);
 
-            SkAutoTUnref<SkTypeface> typeface(set->createTypeface(j));
+            sk_sp<SkTypeface> typeface(set->createTypeface(j));
 
             SkString familyName;
             typeface->getFamilyName(&familyName);
@@ -159,7 +159,7 @@
                 SkDebugf("[%s]\n", familyName.c_str());
             }
 
-            SkAutoTUnref<SkTypeface::LocalizedStrings> familyNamesIter(
+            sk_sp<SkTypeface::LocalizedStrings> familyNamesIter(
                 typeface->createFamilyNameIterator());
             SkTypeface::LocalizedString familyNameLocalized;
             while (familyNamesIter->next(&familyNameLocalized)) {
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 94afec1..12a5b5c 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -298,13 +298,13 @@
     dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
     dummyDesc.fWidth = 34;
     dummyDesc.fHeight = 18;
-    SkAutoTUnref<GrTexture> dummyTexture1(
+    sk_sp<GrTexture> dummyTexture1(
         context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
     dummyDesc.fFlags = kNone_GrSurfaceFlags;
     dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
     dummyDesc.fWidth = 16;
     dummyDesc.fHeight = 22;
-    SkAutoTUnref<GrTexture> dummyTexture2(
+    sk_sp<GrTexture> dummyTexture2(
         context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
 
     if (!dummyTexture1 || ! dummyTexture2) {
@@ -330,7 +330,7 @@
 
         GrPaint grPaint;
 
-        SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
+        sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
         SkASSERT(batch);
 
         GrProcessorTestData ptd(&random, context, context->caps(),
@@ -340,7 +340,7 @@
         bool snapToCenters = set_random_state(&grPaint, &random);
         const GrUserStencilSettings* uss = get_random_stencil(&random);
 
-        renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch, uss, snapToCenters);
+        renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get(), uss, snapToCenters);
     }
     // Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
     drawingManager->flush();
@@ -361,7 +361,7 @@
     for (int i = 0; i < fpFactoryCnt; ++i) {
         // Since FP factories internally randomize, call each 10 times.
         for (int j = 0; j < 10; ++j) {
-            SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
+            sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
             SkASSERT(batch);
             GrProcessorTestData ptd(&random, context, context->caps(),
                                     renderTargetContext.get(), dummyTextures);
@@ -374,7 +374,7 @@
                 BlockInputFragmentProcessor::Make(std::move(fp)));
             grPaint.addColorFragmentProcessor(std::move(blockFP));
 
-            renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+            renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
             drawingManager->flush();
         }
     }
diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp
index 4e8fa2b..b06d3ea 100644
--- a/tests/GifTest.cpp
+++ b/tests/GifTest.cpp
@@ -205,7 +205,7 @@
     }
 
     // Construct a color table for the decode if necessary
-    SkAutoTUnref<SkColorTable> colorTable(nullptr);
+    sk_sp<SkColorTable> colorTable(nullptr);
     SkPMColor* colorPtr = nullptr;
     int* colorCountPtr = nullptr;
     int maxColors = 256;
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 275951b..31ada9d 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -205,8 +205,8 @@
 
 DEF_GPUTEST(GLSampleLocations, reporter, /*factory*/) {
     GLTestSampleLocationsInterface testInterface;
-    SkAutoTUnref<GrContext> ctx(GrContext::Create(kOpenGL_GrBackend, testInterface));
-    test_sampleLocations(reporter, &testInterface, ctx);
+    sk_sp<GrContext> ctx(GrContext::Create(kOpenGL_GrBackend, testInterface));
+    test_sampleLocations(reporter, &testInterface, ctx.get());
 }
 
 #endif
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index ec57377..eb3c9bc 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -70,12 +70,12 @@
         XPInfo(skiatest::Reporter* reporter, SkBlendMode xfermode, const GrCaps& caps,
                const GrPipelineOptimizations& optimizations) {
             sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
-            SkAutoTUnref<GrXferProcessor> xp(
+            sk_sp<GrXferProcessor> xp(
                 xpf->createXferProcessor(optimizations, false, nullptr, caps));
             TEST_ASSERT(!xpf->willNeedDstTexture(caps, optimizations));
             xpf->getInvariantBlendedColor(optimizations.fColorPOI, &fBlendedColor);
             fOptFlags = xp->getOptimizations(optimizations, false, nullptr, caps);
-            GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType);
+            GetXPOutputTypes(xp.get(), &fPrimaryOutputType, &fSecondaryOutputType);
             xp->getBlendInfo(&fBlendInfo);
             TEST_ASSERT(!xp->willReadDstColor());
             TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend));
@@ -1124,8 +1124,7 @@
     sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(SkBlendMode::kSrcOver));
     TEST_ASSERT(!xpf->willNeedDstTexture(caps, opts));
 
-    SkAutoTUnref<GrXferProcessor> xp(
-        xpf->createXferProcessor(opts, false, nullptr, caps));
+    sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(opts, false, nullptr, caps));
     if (!xp) {
         ERRORF(reporter, "Failed to create an XP with LCD coverage.");
         return;
@@ -1199,7 +1198,7 @@
                 sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
                 GrXferProcessor::DstTexture* dstTexture =
                     xpf->willNeedDstTexture(caps, optimizations) ? &fakeDstTexture : 0;
-                SkAutoTUnref<GrXferProcessor> xp(
+                sk_sp<GrXferProcessor> xp(
                     xpf->createXferProcessor(optimizations, false, dstTexture, caps));
                 if (!xp) {
                     ERRORF(reporter, "Failed to create an XP without dual source blending.");
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 1e8f393..ee776e3 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -73,7 +73,7 @@
 }
 
 static void color_gradproc(skiatest::Reporter* reporter, const GradRec& rec, const GradRec&) {
-    SkAutoTUnref<SkShader> s(new SkColorShader(rec.fColors[0]));
+    sk_sp<SkShader> s(new SkColorShader(rec.fColors[0]));
     REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(nullptr));
 
     SkShader::GradientInfo info;
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index c2cf2d9..6d1e1ac 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -121,8 +121,7 @@
         test_cache(reporter, cache, true);
     }
     {
-        SkAutoTUnref<SkDiscardableMemoryPool> pool(
-                SkDiscardableMemoryPool::Create(defLimit, nullptr));
+        sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(defLimit, nullptr));
         gPool = pool.get();
         SkResourceCache cache(pool_factory);
         test_cache(reporter, cache, true);
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 7ab64f5..ebd3186 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -30,7 +30,7 @@
                                const sk_sp<SkSpecialImage>& image,
                                const sk_sp<SkSpecialImage>& subset) {
     static const size_t kCacheSize = 1000000;
-    SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+    sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
 
     SkIRect clip = SkIRect::MakeWH(100, 100);
     SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -54,7 +54,7 @@
                                        const sk_sp<SkSpecialImage>& image,
                                        const sk_sp<SkSpecialImage>& subset) {
     static const size_t kCacheSize = 1000000;
-    SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+    sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
 
     SkIRect clip1 = SkIRect::MakeWH(100, 100);
     SkIRect clip2 = SkIRect::MakeWH(200, 200);
@@ -79,7 +79,7 @@
 static void test_internal_purge(skiatest::Reporter* reporter, const sk_sp<SkSpecialImage>& image) {
     SkASSERT(image->getSize());
     const size_t kCacheSize = image->getSize() + 10;
-    SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+    sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
 
     SkIRect clip = SkIRect::MakeWH(100, 100);
     SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -104,7 +104,7 @@
                                   const sk_sp<SkSpecialImage>& image,
                                   const sk_sp<SkSpecialImage>& subset) {
     static const size_t kCacheSize = 1000000;
-    SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+    sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
 
     SkIRect clip = SkIRect::MakeWH(100, 100);
     SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -191,7 +191,7 @@
 }
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
-    SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
+    sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
     if (!srcTexture) {
         return;
     }
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index f348ac4..0acb428 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -110,7 +110,7 @@
         SkPreMultiplyARGB(0x80, 0x00, 0xA0, 0xFF),
         SkPreMultiplyARGB(0xFF, 0xBB, 0x00, 0xBB)
     };
-    SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
+    sk_sp<SkColorTable> colorTable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
     uint8_t data[] = {
         0, 0, 0, 0, 0,
         0, 1, 1, 1, 0,
@@ -119,7 +119,7 @@
         0, 0, 0, 0, 0
     };
     SkImageInfo info = SkImageInfo::Make(5, 5, kIndex_8_SkColorType, kPremul_SkAlphaType);
-    return SkImage::MakeRasterCopy(SkPixmap(info, data, 5, colorTable));
+    return SkImage::MakeRasterCopy(SkPixmap(info, data, 5, colorTable.get()));
 }
 static sk_sp<SkImage> create_picture_image() {
     SkPictureRecorder recorder;
@@ -307,14 +307,14 @@
     const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
     const SkPMColor blue =  SkPackARGB32(0xFF, 0, 0, 0xFF);
     SkPMColor colors[] = { red, green, blue, 0 };
-    SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
+    sk_sp<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
     // The colortable made a copy, so we can trash the original colors
     memset(colors, 0xFF, sizeof(colors));
 
     const SkImageInfo srcInfo = SkImageInfo::Make(2, 2, kIndex_8_SkColorType, kPremul_SkAlphaType);
     const size_t srcRowBytes = 2 * sizeof(uint8_t);
     uint8_t indices[] = { 0, 1, 2, 3 };
-    sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(srcInfo, indices, srcRowBytes, ctable)));
+    auto image = SkImage::MakeRasterCopy(SkPixmap(srcInfo, indices, srcRowBytes, ctable.get()));
     // The image made a copy, so we can trash the original indices
     memset(indices, 0xFF, sizeof(indices));
 
@@ -556,11 +556,9 @@
 DEF_TEST(ImageFromIndex8Bitmap, r) {
     SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)};
     SkBitmap bm;
-    SkAutoTUnref<SkColorTable> ctable(
-            new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
-    SkImageInfo info =
-            SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
-    bm.allocPixels(info, nullptr, ctable);
+    sk_sp<SkColorTable> ctable( new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
+    SkImageInfo info = SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
+    bm.allocPixels(info, nullptr, ctable.get());
     SkAutoLockPixels autoLockPixels(bm);
     *bm.getAddr8(0, 0) = 0;
     sk_sp<SkImage> img(SkImage::MakeFromBitmap(bm));
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index adc6914..09e1b93 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -24,7 +24,7 @@
     REPORTER_ASSERT(reporter, true);
     SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
     {
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, nullptr));
         // rowbytes too small.
         REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -33,7 +33,7 @@
         size_t rowBytes = info.minRowBytes() - 1;
         size_t size = info.getSafeSize(rowBytes);
         sk_sp<SkData> data(SkData::MakeUninitialized(size));
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
         // rowbytes too small.
         REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -42,7 +42,7 @@
         size_t rowBytes = info.minRowBytes() + 2;
         size_t size = info.getSafeSize(rowBytes) - 1;
         sk_sp<SkData> data(SkData::MakeUninitialized(size));
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
         // data too small.
         REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -51,20 +51,20 @@
     size_t size = info.getSafeSize(rowBytes) + 9;
     {
         SkAutoMalloc memory(size);
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, nullptr));
         REPORTER_ASSERT(reporter, pr.get() != nullptr);
         REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
     }
     {
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr));
         REPORTER_ASSERT(reporter, pr.get() != nullptr);
         REPORTER_ASSERT(reporter, pr->pixels());
     }
     {
         void* addr = static_cast<void*>(new uint8_t[size]);
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
                                           delete_uint8_proc, nullptr));
         REPORTER_ASSERT(reporter, pr.get() != nullptr);
@@ -73,7 +73,7 @@
     {
         int x = 0;
         SkAutoMalloc memory(size);
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr,
                                           memory.get(), set_to_one_proc,
                                           static_cast<void*>(&x)));
@@ -87,7 +87,7 @@
     {
         void* addr = static_cast<void*>(new uint8_t[size]);
         REPORTER_ASSERT(reporter, addr != nullptr);
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
                                           delete_uint8_proc, nullptr));
         REPORTER_ASSERT(reporter, addr == pr->pixels());
@@ -96,7 +96,7 @@
         sk_sp<SkData> data(SkData::MakeUninitialized(size));
         SkData* dataPtr = data.get();
         REPORTER_ASSERT(reporter, dataPtr->unique());
-        SkAutoTUnref<SkMallocPixelRef> pr(
+        sk_sp<SkMallocPixelRef> pr(
             SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
         REPORTER_ASSERT(reporter, !(dataPtr->unique()));
         data.reset(nullptr);
diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp
index 2c0b61d..4bcbb69 100644
--- a/tests/MipMapTest.cpp
+++ b/tests/MipMapTest.cpp
@@ -23,7 +23,7 @@
         int width = 1 + rand.nextU() % 1000;
         int height = 1 + rand.nextU() % 1000;
         make_bitmap(&bm, width, height);
-        SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+        sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
 
         REPORTER_ASSERT(reporter, mm->countLevels() == SkMipMap::ComputeLevelCount(width, height));
         REPORTER_ASSERT(reporter, !mm->extractLevel(SkSize::Make(SK_Scalar1, SK_Scalar1),
@@ -60,7 +60,7 @@
     SkBitmap bm;
     bm.allocN32Pixels(width, height);
     bm.eraseColor(SK_ColorWHITE);
-    SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+    sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
 
     const int mipLevelCount = mm->countLevels();
     REPORTER_ASSERT(reporter, mipLevelCount == expectedMipLevelCount);
@@ -90,7 +90,7 @@
         SkBitmap bm;
         bm.allocN32Pixels(1, 1);
         bm.eraseColor(SK_ColorWHITE);
-        SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+        sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
 
         REPORTER_ASSERT(reporter, mm == nullptr);
     }
diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp
index 89ca6ac..429f8af 100644
--- a/tests/PackedConfigsTextureTest.cpp
+++ b/tests/PackedConfigsTextureTest.cpp
@@ -116,7 +116,7 @@
         desc.fConfig = config;
         desc.fOrigin = 0 == origin ?
             kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
-        SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
+        sk_sp<GrTexture> fpTexture(context->textureProvider()->createTexture(
             desc, SkBudgeted::kNo, controlPixelData.begin(), 0));
         SkASSERT(fpTexture);
         fpTexture->readPixels(0, 0, DEV_W, DEV_H, kRGBA_8888_GrPixelConfig, readBuffer.begin(), 0);
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 01e2ce5..487e519 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -69,7 +69,7 @@
 DEF_TEST(PixelRef_GenIDChange, r) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
 
-    SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
+    sk_sp<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
 
     // Register a listener.
     int count = 0;
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index b48d5ea..4900ed6 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -87,12 +87,12 @@
         private:
             SkTArray<SkString> fAttribNames;
         };
-        SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs));
+        sk_sp<GrGeometryProcessor> gp(new GP(fNumAttribs));
         QuadHelper helper;
         size_t vertexStride = gp->getVertexStride();
         SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, vertexStride, 1));
         vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride);
-        helper.recordDraw(target, gp);
+        helper.recordDraw(target, gp.get());
     }
 
     int fNumAttribs;
@@ -123,11 +123,11 @@
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
-    SkAutoTUnref<GrDrawBatch> batch;
+    sk_sp<GrDrawBatch> batch;
     GrPaint grPaint;
     // This one should succeed.
     batch.reset(new Batch(attribCnt));
-    renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+    renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
@@ -136,7 +136,7 @@
     context->resetGpuStats();
     // This one should fail.
     batch.reset(new Batch(attribCnt+1));
-    renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+    renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 228277a..c0b7e94 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -50,7 +50,7 @@
 
         // We are initializing the texture with zeros here
         memset(alphaData, 0, X_SIZE * Y_SIZE);
-        SkAutoTUnref<GrTexture> texture(
+        sk_sp<GrTexture> texture(
             ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, alphaData,
                                                                   0));
         if (!texture) {
@@ -152,7 +152,7 @@
                     rgbaData[y * X_SIZE + x] = GrColorPackRGBA(6, 7, 8, alphaData[y * X_SIZE + x]);
                 }
             }
-            SkAutoTUnref<GrTexture> texture(
+            sk_sp<GrTexture> texture(
                 ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo,
                                                                       rgbaData, 0));
             if (!texture) {
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index b542986..21540d9 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -59,10 +59,10 @@
         copyDstDesc.fWidth = rectangleTexture->width();
         copyDstDesc.fHeight = rectangleTexture->height();
         copyDstDesc.fFlags = flags;
-        SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(
-                copyDstDesc, SkBudgeted::kYes));
-        context->copySurface(dst, rectangleTexture);
-        test_read_pixels(reporter, context, dst, expectedPixelValues);
+        sk_sp<GrTexture> dst(
+                context->textureProvider()->createTexture(copyDstDesc, SkBudgeted::kYes));
+        context->copySurface(dst.get(), rectangleTexture);
+        test_read_pixels(reporter, context, dst.get(), expectedPixelValues);
     }
 }
 
@@ -81,10 +81,10 @@
         copySrcDesc.fWidth = rectangleTexture->width();
         copySrcDesc.fHeight = rectangleTexture->height();
         copySrcDesc.fFlags = flags;
-        SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture(
+        sk_sp<GrTexture> src(context->textureProvider()->createTexture(
                 copySrcDesc, SkBudgeted::kYes, pixels.get(), 0));
 
-        context->copySurface(rectangleTexture, src);
+        context->copySurface(rectangleTexture, src.get());
         test_read_pixels(reporter, context, rectangleTexture, pixels.get());
     }
 }
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 5a0f7e0..6c55f8a 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -103,12 +103,12 @@
     GrTextureProvider* cache = context->textureProvider();
     GrResourceProvider* resourceProvider = context->resourceProvider();
     // Test that two budgeted RTs with the same desc share a stencil buffer.
-    SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
+    sk_sp<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
     if (smallRT0 && smallRT0->asRenderTarget()) {
         resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget());
     }
 
-    SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
+    sk_sp<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
     if (smallRT1 && smallRT1->asRenderTarget()) {
         resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget());
     }
@@ -120,7 +120,7 @@
                     resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget()));
 
     // An unbudgeted RT with the same desc should also share.
-    SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
+    sk_sp<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
     if (smallRT2 && smallRT2->asRenderTarget()) {
         resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget());
     }
@@ -137,7 +137,7 @@
     bigDesc.fWidth = 400;
     bigDesc.fHeight = 200;
     bigDesc.fSampleCnt = 0;
-    SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
+    sk_sp<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
     if (bigRT && bigRT->asRenderTarget()) {
         resourceProvider->attachStencilAttachment(bigRT->asRenderTarget());
     }
@@ -151,7 +151,7 @@
         // An RT with a different sample count should not share.
         GrSurfaceDesc smallMSAADesc = smallDesc;
         smallMSAADesc.fSampleCnt = 4;
-        SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+        sk_sp<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
         if (smallMSAART0 && smallMSAART0->asRenderTarget()) {
             resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget());
         }
@@ -167,7 +167,7 @@
                         resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) !=
                         resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()));
         // A second MSAA RT should share with the first MSAA RT.
-        SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+        sk_sp<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
         if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
             resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
         }
@@ -184,7 +184,7 @@
             smallMSAART0->asRenderTarget()->numColorSamples() < 8) {
             smallMSAADesc.fSampleCnt = 8;
             smallMSAART1.reset(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
-            SkAutoTUnref<GrTexture> smallMSAART1(
+            sk_sp<GrTexture> smallMSAART1(
                     cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
             if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
                 resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
@@ -360,10 +360,10 @@
 
     GrResourceCache* cache() { return fContext->getResourceCache(); }
 
-    GrContext* context() { return fContext; }
+    GrContext* context() { return fContext.get(); }
 
 private:
-    SkAutoTUnref<GrContext> fContext;
+    sk_sp<GrContext> fContext;
 };
 
 static void test_no_key(skiatest::Reporter* reporter) {
@@ -881,7 +881,7 @@
     {
         GrUniqueKey key2;
         make_unique_key<0>(&key2, 0);
-        SkAutoTUnref<TestResource> d(new TestResource(context->getGpu()));
+        sk_sp<TestResource> d(new TestResource(context->getGpu()));
         int foo = 4132;
         key2.setCustomData(SkData::MakeWithCopy(&foo, sizeof(foo)));
         d->resourcePriv().setUniqueKey(key2);
@@ -889,7 +889,7 @@
 
     GrUniqueKey key3;
     make_unique_key<0>(&key3, 0);
-    SkAutoTUnref<GrGpuResource> d2(cache->findAndRefUniqueResource(key3));
+    sk_sp<GrGpuResource> d2(cache->findAndRefUniqueResource(key3));
     REPORTER_ASSERT(reporter, *(int*) d2->getUniqueKey().getCustomData()->data() == 4132);
 }
 
@@ -1019,10 +1019,10 @@
         REPORTER_ASSERT(reporter, 200 == cache->getResourceBytes());
         REPORTER_ASSERT(reporter, 2 == cache->getResourceCount());
         {
-            SkAutoTUnref<TestResource> find2(
+            sk_sp<TestResource> find2(
                 static_cast<TestResource*>(cache->findAndRefUniqueResource(key2)));
             find2->setSize(200);
-            SkAutoTUnref<TestResource> find1(
+            sk_sp<TestResource> find1(
                 static_cast<TestResource*>(cache->findAndRefUniqueResource(key1)));
             find1->setSize(50);
         }
@@ -1051,7 +1051,7 @@
         REPORTER_ASSERT(reporter, 2 == cache->getResourceCount());
 
         {
-            SkAutoTUnref<TestResource> find2(static_cast<TestResource*>(
+            sk_sp<TestResource> find2(static_cast<TestResource*>(
                 cache->findAndRefUniqueResource(key2)));
             find2->setSize(201);
         }
@@ -1300,7 +1300,7 @@
 static void test_abandoned(skiatest::Reporter* reporter) {
     Mock mock(10, 300);
     GrContext* context = mock.context();
-    SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu()));
+    sk_sp<GrGpuResource> resource(new TestResource(context->getGpu()));
     context->abandonContext();
 
     REPORTER_ASSERT(reporter, resource->wasDestroyed());
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index b22e0b9..4261796 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -117,7 +117,7 @@
     desc.fHeight = texS;
 
     GrTextureProvider* texProvider = context->textureProvider();
-    SkAutoTUnref<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
+    sk_sp<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
 
     // Create two render target contexts (L32 and S32)
     sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
@@ -131,7 +131,7 @@
     GrPaint paint;
     paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
     GrTextureParams mipMapParams(SkShader::kRepeat_TileMode, GrTextureParams::kMipMap_FilterMode);
-    paint.addColorTextureProcessor(texture, nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
+    paint.addColorTextureProcessor(texture.get(), nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
 
     // 1) Draw texture to S32 surface (should generate/use sRGB mips)
     paint.setGammaCorrect(true);
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 840575a..4295167 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -162,8 +162,7 @@
     desc.fConfig = kSRGBA_8888_GrPixelConfig;
     if (context->caps()->isConfigRenderable(desc.fConfig, false) &&
         context->caps()->isConfigTexturable(desc.fConfig)) {
-        SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(
-                desc, SkBudgeted::kNo));
+        sk_sp<GrTexture> tex(context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
         if (!tex) {
             ERRORF(reporter, "Could not create SRGBA texture.");
             return;
@@ -178,10 +177,10 @@
             // the shader.
             float smallError = context->caps()->shaderCaps()->floatPrecisionVaries() ? 1.f :
                     0.0f;
-            read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
                                   check_srgb_to_linear_to_srgb_conversion, smallError,
                                   "write/read srgba to srgba texture");
-            read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
                                   check_srgb_to_linear_conversion, error,
                                   "write srgba/read rgba with srgba texture");
         } else {
@@ -191,10 +190,10 @@
         // Now verify that we can write linear data
         if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData)) {
             // We allow more error on GPUs with lower precision shader variables.
-            read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
                                   check_linear_to_srgb_conversion, error,
                                   "write rgba/read srgba with srgba texture");
-            read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
                                   check_linear_to_srgb_to_linear_conversion, error,
                                   "write/read rgba with srgba texture");
         } else {
@@ -210,10 +209,10 @@
 
         // Write srgba data to a rgba texture and read back as srgba and rgba
         if (tex->writePixels(0, 0, kW, kH, kSRGBA_8888_GrPixelConfig, origData)) {
-            read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
                                   check_srgb_to_linear_to_srgb_conversion, error,
                                   "write/read srgba to rgba texture");
-            read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
                                   check_srgb_to_linear_conversion, error,
                                   "write srgba/read rgba to rgba texture");
         } else {
@@ -222,7 +221,7 @@
 
         // Write rgba data to a rgba texture and read back as srgba
         if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData)) {
-            read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+            read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
                                   check_linear_to_srgb_conversion, 1.2f,
                                   "write rgba/read srgba to rgba texture");
         } else {
diff --git a/tests/SVGDeviceTest.cpp b/tests/SVGDeviceTest.cpp
index 494efbb..b010e57 100644
--- a/tests/SVGDeviceTest.cpp
+++ b/tests/SVGDeviceTest.cpp
@@ -91,8 +91,7 @@
 
     {
         SkXMLParserWriter writer(dom.beginParsing());
-        SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
-                                                             &writer));
+        sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
         svgCanvas->drawText(txt, len, offset.x(), offset.y(), paint);
     }
     check_text_node(reporter, dom, dom.finishParsing(), offset, 0, expected);
@@ -104,8 +103,7 @@
         }
 
         SkXMLParserWriter writer(dom.beginParsing());
-        SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
-                                                             &writer));
+        sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
         svgCanvas->drawPosTextH(txt, len, xpos, offset.y(), paint);
     }
     check_text_node(reporter, dom, dom.finishParsing(), offset, 1, expected);
@@ -117,8 +115,7 @@
         }
 
         SkXMLParserWriter writer(dom.beginParsing());
-        SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
-                                                             &writer));
+        sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
         svgCanvas->drawPosText(txt, len, pos, paint);
     }
     check_text_node(reporter, dom, dom.finishParsing(), offset, 2, expected);
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 0e5e8ec..3de422b 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -290,7 +290,7 @@
         }
         auto mode(SkXfermode::Make(static_cast<SkXfermode::Mode>(i)));
         REPORTER_ASSERT(reporter, mode);
-        SkAutoTUnref<SkXfermode> copy(
+        sk_sp<SkXfermode> copy(
             TestFlattenableSerialization<SkXfermode>(mode.get(), true, reporter));
     }
 }
@@ -301,7 +301,7 @@
         table[i] = (i * 41) % 256;
     }
     auto colorFilter(SkTableColorFilter::Make(table));
-    SkAutoTUnref<SkColorFilter> copy(
+    sk_sp<SkColorFilter> copy(
         TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, reporter));
 }
 
@@ -612,22 +612,22 @@
         sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuseShader,
                                                                 normalSource,
                                                                 fLights);
-        SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+        sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
 
         lightingShader = SkLightingShader::Make(std::move(diffuseShader),
                                                 nullptr,
                                                 fLights);
-        SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+        sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
 
         lightingShader = SkLightingShader::Make(nullptr,
                                                 std::move(normalSource),
                                                 fLights);
-        SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+        sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
 
         lightingShader = SkLightingShader::Make(nullptr,
                                                 nullptr,
                                                 fLights);
-        SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+        sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
     }
 
     // Test NormalBevelSource serialization
@@ -635,8 +635,7 @@
         sk_sp<SkNormalSource> bevelSource = SkNormalSource::MakeBevel(
                 SkNormalSource::BevelType::kLinear, 2.0f, 5.0f);
 
-        SkAutoTUnref<SkNormalSource>(TestFlattenableSerialization(bevelSource.get(), true,
-                                                                  reporter));
+        sk_sp<SkNormalSource>(TestFlattenableSerialization(bevelSource.get(), true, reporter));
         // TODO test equality?
 
     }
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 615c7b4..9275dff 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -23,8 +23,8 @@
         bitmap->setInfo(info);
         SkPMColor ctStorage[256];
         memset(ctStorage, 0xFF, sizeof(ctStorage)); // init with opaque-white for the moment
-        SkAutoTUnref<SkColorTable> ctable(new SkColorTable(ctStorage, 256));
-        bitmap->allocPixels(allocator, ctable);
+        sk_sp<SkColorTable> ctable(new SkColorTable(ctStorage, 256));
+        bitmap->allocPixels(allocator, ctable.get());
     } else if (allocator) {
         bitmap->setInfo(info);
         allocator->allocPixelRef(bitmap, 0);
@@ -260,8 +260,7 @@
         testBitmapCache_discarded_bitmap(reporter, &cache, nullptr);
     }
     {
-        SkAutoTUnref<SkDiscardableMemoryPool> pool(
-            SkDiscardableMemoryPool::Create(byteLimit, nullptr));
+        sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(byteLimit, nullptr));
         gPool = pool.get();
         SkResourceCache::DiscardableFactory factory = pool_factory;
         SkResourceCache cache(factory);
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index d850daa..c87926e 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -444,7 +444,7 @@
         desc.fWidth = dim.fX;
         desc.fHeight = dim.fY;
         desc.fSampleCnt = 0;
-        SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0));
+        sk_sp<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0));
         if (!texture) {
             SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename,
                 dim.fX, dim.fY);
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 9866358..b755a7e 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -764,7 +764,7 @@
     std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
     sk_memset32(pixels.get(), ~expectedValue, w * h);
 
-    SkAutoTUnref<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface.get())));
+    sk_sp<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface.get())));
     if (!grSurface) {
         ERRORF(reporter, "Could access render target of GPU SkSurface.");
         return;
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 964a64f..995328d 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -66,7 +66,7 @@
 
     SkCanvas* canvas = surface->getCanvas();
 
-    SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+    sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
 
     int count = SkMin32(fm->countFamilies(), maxFamilies);
 
@@ -85,7 +85,7 @@
 
         SkString familyName;
         fm->getFamilyName(i, &familyName);
-        SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+        sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
         for (int j = 0; j < set->count(); ++j) {
             SkFontStyle fs;
             set->getStyle(j, &fs, nullptr);
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index b38bb9f..b6f90e0 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -29,7 +29,7 @@
     RefClass obj(0);
     REPORTER_ASSERT(reporter, obj.unique());
 
-    SkAutoTUnref<RefClass> tmp(&obj);
+    sk_sp<RefClass> tmp(&obj);
     REPORTER_ASSERT(reporter, &obj == tmp.get());
     REPORTER_ASSERT(reporter, obj.unique());
 
@@ -41,7 +41,7 @@
     obj.ref();
     REPORTER_ASSERT(reporter, !obj.unique());
     {
-        SkAutoTUnref<RefClass> tmp2(&obj);
+        sk_sp<RefClass> tmp2(&obj);
     }
     REPORTER_ASSERT(reporter, obj.unique());
 }
@@ -53,7 +53,7 @@
     REPORTER_ASSERT(reporter, obj1.unique());
 
     {
-        SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp;
+        SkAutoSTArray<2, sk_sp<RefClass> > tmp;
         REPORTER_ASSERT(reporter, 0 == tmp.count());
 
         tmp.reset(0);   // test out reset(0) when already at 0
@@ -82,7 +82,7 @@
 
     {
         // test out allocating ctor (this should allocate new memory)
-        SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp(4);
+        SkAutoSTArray<2, sk_sp<RefClass> > tmp(4);
         REPORTER_ASSERT(reporter, 4 == tmp.count());
 
         tmp[0].reset(SkRef(&obj0));