| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does | 274 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does |
| 275 // not break JPEG decoding at a critical point: in between a call to decode the | 275 // not break JPEG decoding at a critical point: in between a call to decode the |
| 276 // size (when JPEGImageDecoder stops while it may still have input data to | 276 // size (when JPEGImageDecoder stops while it may still have input data to |
| 277 // read) and a call to do a full decode. | 277 // read) and a call to do a full decode. |
| 278 TEST(JPEGImageDecoderTest, mergeBuffer) | 278 TEST(JPEGImageDecoderTest, mergeBuffer) |
| 279 { | 279 { |
| 280 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; | 280 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; |
| 281 testMergeBuffer(&createDecoder, jpegFile); | 281 testMergeBuffer(&createDecoder, jpegFile); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST(JPEGImageDecoderTest, hasAlphaAtIndex) |
| 285 { |
| 286 const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; |
| 287 RefPtr<SharedBuffer> data = readFile(jpegFile); |
| 288 ASSERT_TRUE(data); |
| 289 |
| 290 OwnPtr<ImageDecoder> decoder = createDecoder(); |
| 291 EXPECT_TRUE(decoder->frameHasAlphaAtIndex(0)); |
| 292 |
| 293 decoder->setData(data.get(), false); |
| 294 EXPECT_TRUE(decoder->frameHasAlphaAtIndex(0)); |
| 295 EXPECT_TRUE(decoder->frameHasAlphaAtIndex(1)); |
| 296 |
| 297 decoder->setData(data.get(), true); |
| 298 EXPECT_FALSE(decoder->frameHasAlphaAtIndex(0)); |
| 299 EXPECT_TRUE(decoder->frameHasAlphaAtIndex(1)); |
| 300 } |
| 301 |
| 284 } // namespace blink | 302 } // namespace blink |
| OLD | NEW |