| Index: tests/CodexTest.cpp
|
| diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
|
| index f1c5bbaa128e1c989bf06af39f27f7a22e211864..b6ff08cdd7e149e4ad17c6fc83b01693ffeebebe 100644
|
| --- a/tests/CodexTest.cpp
|
| +++ b/tests/CodexTest.cpp
|
| @@ -362,8 +362,11 @@ DEF_TEST(Codec_stripes, r) {
|
| }
|
|
|
| static void test_invalid_stream(skiatest::Reporter* r, const void* stream, size_t len) {
|
| + // Neither of these calls should return a codec. Bots should catch us if we leaked anything.
|
| SkCodec* codec = SkCodec::NewFromStream(new SkMemoryStream(stream, len, false));
|
| - // We should not have gotten a codec. Bots should catch us if we leaked anything.
|
| + REPORTER_ASSERT(r, !codec);
|
| +
|
| + codec = SkScaledCodec::NewFromStream(new SkMemoryStream(stream, len, false));
|
| REPORTER_ASSERT(r, !codec);
|
| }
|
|
|
| @@ -390,6 +393,16 @@ DEF_TEST(Codec_leaks, r) {
|
| test_invalid_stream(r, emptyGif, sizeof(emptyGif));
|
| }
|
|
|
| +DEF_TEST(Codec_null, r) {
|
| + // Attempting to create an SkCodec or an SkScaledCodec with null should not
|
| + // crash.
|
| + SkCodec* codec = SkCodec::NewFromStream(nullptr);
|
| + REPORTER_ASSERT(r, !codec);
|
| +
|
| + codec = SkScaledCodec::NewFromStream(nullptr);
|
| + REPORTER_ASSERT(r, !codec);
|
| +}
|
| +
|
| static void test_dimensions(skiatest::Reporter* r, const char path[]) {
|
| // Create the codec from the resource file
|
| SkAutoTDelete<SkStream> stream(resource(path));
|
|
|