| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Send data to the decoder byte-by-byte and use the provided frame offset in | 145 // Send data to the decoder byte-by-byte and use the provided frame offset in |
| 146 // the data to check that isSizeAvailable() changes state only when that | 146 // the data to check that isSizeAvailable() changes state only when that |
| 147 // offset is reached. Also check other decoder state. | 147 // offset is reached. Also check other decoder state. |
| 148 for (size_t length = 1; length <= frameOffset; ++length) { | 148 for (size_t length = 1; length <= frameOffset; ++length) { |
| 149 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), length); | 149 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), length); |
| 150 decoder->setData(tempData.get(), false); | 150 decoder->setData(tempData.get(), false); |
| 151 | 151 |
| 152 if (length < frameOffset) { | 152 if (length < frameOffset) { |
| 153 EXPECT_FALSE(decoder->isSizeAvailable()); | 153 EXPECT_FALSE(decoder->isSizeAvailable()); |
| 154 EXPECT_TRUE(decoder->size().isEmpty()); | 154 EXPECT_TRUE(decoder->size().isEmpty()); |
| 155 EXPECT_FALSE(decoder->hasColorSpace()); | 155 EXPECT_FALSE(decoder->hasEmbeddedColorSpace()); |
| 156 EXPECT_EQ(0u, decoder->frameCount()); | 156 EXPECT_EQ(0u, decoder->frameCount()); |
| 157 EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); | 157 EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); |
| 158 EXPECT_FALSE(decoder->frameBufferAtIndex(0)); | 158 EXPECT_FALSE(decoder->frameBufferAtIndex(0)); |
| 159 } else { | 159 } else { |
| 160 EXPECT_TRUE(decoder->isSizeAvailable()); | 160 EXPECT_TRUE(decoder->isSizeAvailable()); |
| 161 EXPECT_FALSE(decoder->size().isEmpty()); | 161 EXPECT_FALSE(decoder->size().isEmpty()); |
| 162 EXPECT_EQ(decoder->hasColorSpace(), hasColorSpace); | 162 EXPECT_EQ(decoder->hasEmbeddedColorSpace(), hasColorSpace); |
| 163 EXPECT_EQ(1u, decoder->frameCount()); | 163 EXPECT_EQ(1u, decoder->frameCount()); |
| 164 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); | 164 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 EXPECT_FALSE(decoder->failed()); | 167 EXPECT_FALSE(decoder->failed()); |
| 168 if (decoder->failed()) | 168 if (decoder->failed()) |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 std::unique_ptr<ImageDecoder> decoder = createDecoder(); | 727 std::unique_ptr<ImageDecoder> decoder = createDecoder(); |
| 728 RefPtr<SharedBuffer> data = readFile( | 728 RefPtr<SharedBuffer> data = readFile( |
| 729 "/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp"); | 729 "/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp"); |
| 730 ASSERT_TRUE(data.get()); | 730 ASSERT_TRUE(data.get()); |
| 731 decoder->setData(data.get(), true); | 731 decoder->setData(data.get(), true); |
| 732 EXPECT_EQ(1u, decoder->frameCount()); | 732 EXPECT_EQ(1u, decoder->frameCount()); |
| 733 EXPECT_EQ(cAnimationNone, decoder->repetitionCount()); | 733 EXPECT_EQ(cAnimationNone, decoder->repetitionCount()); |
| 734 } | 734 } |
| 735 | 735 |
| 736 } // namespace blink | 736 } // namespace blink |
| OLD | NEW |