diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp
index 274d53e..0ba3af9 100644
--- a/tests/AnnotationTest.cpp
+++ b/tests/AnnotationTest.cpp
@@ -39,11 +39,6 @@
     REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0));
 }
 
-struct testCase {
-    SkPDFDocument::Flags flags;
-    bool expectAnnotations;
-};
-
 DEF_TEST(Annotation_PdfLink, reporter) {
     SkISize size = SkISize::Make(612, 792);
     SkMatrix initialTransform;
@@ -56,20 +51,14 @@
     SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com"));
     SkAnnotateRectWithURL(&canvas, r, data.get());
 
-    testCase tests[] = {{(SkPDFDocument::Flags)0, true},
-                        {SkPDFDocument::kNoLinks_Flags, false}};
-    for (size_t testNum = 0; testNum < SK_ARRAY_COUNT(tests); testNum++) {
-        SkPDFDocument doc(tests[testNum].flags);
-        doc.appendPage(&device);
-        SkDynamicMemoryWStream outStream;
-        doc.emitPDF(&outStream);
-        SkAutoDataUnref out(outStream.copyToData());
-        const char* rawOutput = (const char*)out->data();
+    SkPDFDocument doc;
+    doc.appendPage(&device);
+    SkDynamicMemoryWStream outStream;
+    doc.emitPDF(&outStream);
+    SkAutoDataUnref out(outStream.copyToData());
+    const char* rawOutput = (const char*)out->data();
 
-        REPORTER_ASSERT(reporter,
-            ContainsString(rawOutput, out->size(), "/Annots ")
-            == tests[testNum].expectAnnotations);
-    }
+    REPORTER_ASSERT(reporter, ContainsString(rawOutput, out->size(), "/Annots "));
 }
 
 DEF_TEST(Annotation_NamedDestination, reporter) {
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 44fec38..2d4ac77 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -75,12 +75,8 @@
 
 static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj,
                               const char* expectedData, size_t expectedSize,
-                              bool indirect, bool compression) {
-    SkPDFDocument::Flags docFlags = (SkPDFDocument::Flags) 0;
-    if (!compression) {
-        docFlags = SkTBitOr(docFlags, SkPDFDocument::kFavorSpeedOverSize_Flags);
-    }
-    SkPDFCatalog catalog(docFlags);
+                              bool indirect) {
+    SkPDFCatalog catalog;
     size_t directSize = get_output_size(obj, &catalog, false);
     REPORTER_ASSERT(reporter, directSize == expectedSize);
 
@@ -118,7 +114,7 @@
                                     SkPDFObject* obj,
                                     const char* expectedResult) {
     CheckObjectOutput(reporter, obj, expectedResult,
-                      strlen(expectedResult), true, false);
+                      strlen(expectedResult), true);
 }
 
 static void TestPDFStream(skiatest::Reporter* reporter) {
@@ -148,32 +144,21 @@
         SkFlate::Deflate(streamData2.get(), &compressedByteStream);
         SkAutoDataUnref compressedData(compressedByteStream.copyToData());
 
-        // Check first without compression.
-        SkDynamicMemoryWStream expectedResult1;
-        expectedResult1.writeText("<</Length 167\n>> stream\n");
-        expectedResult1.writeText(streamBytes2);
-        expectedResult1.writeText("\nendstream");
-        SkAutoDataUnref expectedResultData1(expectedResult1.copyToData());
-        CheckObjectOutput(reporter, stream.get(),
-                          (const char*) expectedResultData1->data(),
-                          expectedResultData1->size(), true, false);
-
-        // Then again with compression.
-        SkDynamicMemoryWStream expectedResult2;
-        expectedResult2.writeText("<</Filter /FlateDecode\n/Length 116\n"
+        SkDynamicMemoryWStream expected;
+        expected.writeText("<</Filter /FlateDecode\n/Length 116\n"
                                  ">> stream\n");
-        expectedResult2.write(compressedData->data(), compressedData->size());
-        expectedResult2.writeText("\nendstream");
-        SkAutoDataUnref expectedResultData2(expectedResult2.copyToData());
+        expected.write(compressedData->data(), compressedData->size());
+        expected.writeText("\nendstream");
+        SkAutoDataUnref expectedResultData2(expected.copyToData());
         CheckObjectOutput(reporter, stream.get(),
                           (const char*) expectedResultData2->data(),
-                          expectedResultData2->size(), true, true);
+                          expectedResultData2->size(), true);
     }
 #endif  // SK_NO_FLATE
 }
 
 static void TestCatalog(skiatest::Reporter* reporter) {
-    SkPDFCatalog catalog((SkPDFDocument::Flags)0);
+    SkPDFCatalog catalog;
     SkAutoTUnref<SkPDFInt> int1(new SkPDFInt(1));
     SkAutoTUnref<SkPDFInt> int2(new SkPDFInt(2));
     SkAutoTUnref<SkPDFInt> int3(new SkPDFInt(3));
@@ -195,7 +180,7 @@
     SkAutoTUnref<SkPDFInt> int2(new SkPDFInt(2));
     SkAutoTUnref<SkPDFObjRef> int2ref(new SkPDFObjRef(int2.get()));
 
-    SkPDFCatalog catalog((SkPDFDocument::Flags)0);
+    SkPDFCatalog catalog;
     catalog.addObject(int1.get(), false);
     catalog.addObject(int2.get(), false);
     REPORTER_ASSERT(reporter, catalog.getObjectNumber(int1.get()) == 1);
@@ -216,7 +201,7 @@
     proxy->insert("Value", new SkPDFInt(33))->unref();
     stub->insert("Value", new SkPDFInt(44))->unref();
 
-    SkPDFCatalog catalog((SkPDFDocument::Flags)0);
+    SkPDFCatalog catalog;
     catalog.addObject(proxy.get(), false);
     catalog.setSubstitute(proxy.get(), stub.get());
 
@@ -278,12 +263,12 @@
     SkAutoTUnref<SkPDFName> name(new SkPDFName("Test name\twith#tab"));
     const char expectedResult[] = "/Test#20name#09with#23tab";
     CheckObjectOutput(reporter, name.get(), expectedResult,
-                      strlen(expectedResult), false, false);
+                      strlen(expectedResult), false);
 
     SkAutoTUnref<SkPDFName> escapedName(new SkPDFName("A#/%()<>[]{}B"));
     const char escapedNameExpected[] = "/A#23#2F#25#28#29#3C#3E#5B#5D#7B#7DB";
     CheckObjectOutput(reporter, escapedName.get(), escapedNameExpected,
-                      strlen(escapedNameExpected), false, false);
+                      strlen(escapedNameExpected), false);
 
     // Test that we correctly handle characters with the high-bit set.
     const unsigned char highBitCString[] = {0xDE, 0xAD, 'b', 'e', 0xEF, 0};
@@ -291,7 +276,7 @@
         new SkPDFName((const char*)highBitCString));
     const char highBitExpectedResult[] = "/#DE#ADbe#EF";
     CheckObjectOutput(reporter, highBitName.get(), highBitExpectedResult,
-                      strlen(highBitExpectedResult), false, false);
+                      strlen(highBitExpectedResult), false);
 
     SkAutoTUnref<SkPDFArray> array(new SkPDFArray);
     SimpleCheckObjectOutput(reporter, array.get(), "[]");
