| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 decoder->SetImagePlanes(std::move(image_planes)); | 266 decoder->SetImagePlanes(std::move(image_planes)); |
| 267 ASSERT_TRUE(decoder->IsSizeAvailable()); | 267 ASSERT_TRUE(decoder->IsSizeAvailable()); |
| 268 ASSERT_FALSE(decoder->CanDecodeToYUV()); | 268 ASSERT_FALSE(decoder->CanDecodeToYUV()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 TEST(JPEGImageDecoderTest, | 271 TEST(JPEGImageDecoderTest, |
| 272 byteByByteBaselineJPEGWithColorProfileAndRestartMarkers) { | 272 byteByByteBaselineJPEGWithColorProfileAndRestartMarkers) { |
| 273 TestByteByByteDecode(&CreateDecoder, | 273 TestByteByByteDecode(&CreateDecoder, |
| 274 "/LayoutTests/images/resources/" | 274 "/LayoutTests/images/resources/" |
| 275 "small-square-with-colorspin-profile.jpg", | 275 "small-square-with-colorspin-profile.jpg", |
| 276 1u, kAnimationNone); | 276 1u, kCAnimationNone); |
| 277 } | 277 } |
| 278 | 278 |
| 279 TEST(JPEGImageDecoderTest, byteByByteProgressiveJPEG) { | 279 TEST(JPEGImageDecoderTest, byteByByteProgressiveJPEG) { |
| 280 TestByteByByteDecode(&CreateDecoder, | 280 TestByteByByteDecode(&CreateDecoder, |
| 281 "/LayoutTests/images/resources/bug106024.jpg", 1u, | 281 "/LayoutTests/images/resources/bug106024.jpg", 1u, |
| 282 kAnimationNone); | 282 kCAnimationNone); |
| 283 } | 283 } |
| 284 | 284 |
| 285 TEST(JPEGImageDecoderTest, byteByByteRGBJPEGWithAdobeMarkers) { | 285 TEST(JPEGImageDecoderTest, byteByByteRGBJPEGWithAdobeMarkers) { |
| 286 TestByteByByteDecode( | 286 TestByteByByteDecode( |
| 287 &CreateDecoder, | 287 &CreateDecoder, |
| 288 "/LayoutTests/images/resources/rgb-jpeg-with-adobe-marker-only.jpg", 1u, | 288 "/LayoutTests/images/resources/rgb-jpeg-with-adobe-marker-only.jpg", 1u, |
| 289 kAnimationNone); | 289 kCAnimationNone); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // This test verifies that calling SharedBuffer::MergeSegmentsIntoBuffer() does | 292 // This test verifies that calling SharedBuffer::MergeSegmentsIntoBuffer() does |
| 293 // not break JPEG decoding at a critical point: in between a call to decode the | 293 // not break JPEG decoding at a critical point: in between a call to decode the |
| 294 // size (when JPEGImageDecoder stops while it may still have input data to | 294 // size (when JPEGImageDecoder stops while it may still have input data to |
| 295 // read) and a call to do a full decode. | 295 // read) and a call to do a full decode. |
| 296 TEST(JPEGImageDecoderTest, mergeBuffer) { | 296 TEST(JPEGImageDecoderTest, mergeBuffer) { |
| 297 const char* jpeg_file = "/LayoutTests/images/resources/lenna.jpg"; | 297 const char* jpeg_file = "/LayoutTests/images/resources/lenna.jpg"; |
| 298 TestMergeBuffer(&CreateDecoder, jpeg_file); | 298 TestMergeBuffer(&CreateDecoder, jpeg_file); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // This tests decoding a JPEG with many progressive scans. Decoding should | 301 // This tests decoding a JPEG with many progressive scans. Decoding should |
| 302 // fail, but not hang (crbug.com/642462). | 302 // fail, but not hang (crbug.com/642462). |
| 303 TEST(JPEGImageDecoderTest, manyProgressiveScans) { | 303 TEST(JPEGImageDecoderTest, manyProgressiveScans) { |
| 304 RefPtr<SharedBuffer> test_data = | 304 RefPtr<SharedBuffer> test_data = |
| 305 ReadFile(kDecodersTestingDir, "many-progressive-scans.jpg"); | 305 ReadFile(kDecodersTestingDir, "many-progressive-scans.jpg"); |
| 306 ASSERT_TRUE(test_data.Get()); | 306 ASSERT_TRUE(test_data.Get()); |
| 307 | 307 |
| 308 std::unique_ptr<ImageDecoder> test_decoder = CreateDecoder(); | 308 std::unique_ptr<ImageDecoder> test_decoder = CreateDecoder(); |
| 309 test_decoder->SetData(test_data.Get(), true); | 309 test_decoder->SetData(test_data.Get(), true); |
| 310 EXPECT_EQ(1u, test_decoder->FrameCount()); | 310 EXPECT_EQ(1u, test_decoder->FrameCount()); |
| 311 ASSERT_TRUE(test_decoder->FrameBufferAtIndex(0)); | 311 ASSERT_TRUE(test_decoder->FrameBufferAtIndex(0)); |
| 312 EXPECT_TRUE(test_decoder->Failed()); | 312 EXPECT_TRUE(test_decoder->Failed()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |