Chromium Code Reviews| Index: tests/PDFPrimitivesTest.cpp |
| diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp |
| index f15f06090d7b10787e32f9f6498290224abcf127..edcd36d1c24946e175ba141631709f4ed849d55c 100644 |
| --- a/tests/PDFPrimitivesTest.cpp |
| +++ b/tests/PDFPrimitivesTest.cpp |
| @@ -237,38 +237,16 @@ static void TestObjectRef(skiatest::Reporter* reporter) { |
| static void TestSubstitute(skiatest::Reporter* reporter) { |
| SkAutoTUnref<SkPDFTestDict> proxy(new SkPDFTestDict()); |
| SkAutoTUnref<SkPDFTestDict> stub(new SkPDFTestDict()); |
| - SkAutoTUnref<SkPDFInt> int33(new SkPDFInt(33)); |
| - SkAutoTUnref<SkPDFDict> stubResource(new SkPDFDict()); |
| - SkAutoTUnref<SkPDFInt> int44(new SkPDFInt(44)); |
| - stub->insert("Value", int33.get()); |
| - stubResource->insert("InnerValue", int44.get()); |
| - stub->addResource(stubResource.get()); |
| + proxy->insert("Value", new SkPDFInt(33))->unref(); |
|
mtklein
2015/01/26 23:38:59
If we're getting serious about PDF memory allocati
hal.canary
2015/02/09 23:35:01
Acknowledged.
Let's do that *after* making these
|
| + stub->insert("Value", new SkPDFInt(44))->unref(); |
| SkPDFCatalog catalog((SkPDFDocument::Flags)0); |
| catalog.addObject(proxy.get(), false); |
| catalog.setSubstitute(proxy.get(), stub.get()); |
| - SkDynamicMemoryWStream buffer; |
| - emit_object(proxy, &buffer, &catalog, false); |
| - SkTSet<SkPDFObject*>* substituteResources = |
| - catalog.getSubstituteList(false); |
| - for (int i = 0; i < substituteResources->count(); ++i) { |
| - emit_object((*substituteResources)[i], &buffer, &catalog, true); |
| - } |
| - |
| - char objectResult[] = "2 0 obj\n<</Value 33\n>>\nendobj\n"; |
| - catalog.setFileOffset(proxy.get(), 0); |
| - |
| - size_t outputSize = get_output_size( |
| - catalog.getSubstituteObject(proxy.get()), &catalog, true); |
| - REPORTER_ASSERT(reporter, outputSize == strlen(objectResult)); |
| - |
| - char expectedResult[] = |
| - "<</Value 33\n>>1 0 obj\n<</InnerValue 44\n>>\nendobj\n"; |
| - REPORTER_ASSERT(reporter, buffer.getOffset() == strlen(expectedResult)); |
| - REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult, |
| - buffer.getOffset())); |
| + REPORTER_ASSERT(reporter, stub.get() == catalog.getSubstituteObject(proxy)); |
| + REPORTER_ASSERT(reporter, proxy.get() != catalog.getSubstituteObject(stub)); |
| } |
| // Create a bitmap that would be very eficiently compressed in a ZIP. |