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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 bool match = true; | 234 bool match = true; |
235 for (size_t i = 0; i < truncatedHashes.size(); ++i) { | 235 for (size_t i = 0; i < truncatedHashes.size(); ++i) { |
236 if (truncatedHashes[i] != progressiveHashes[i]) { | 236 if (truncatedHashes[i] != progressiveHashes[i]) { |
237 match = false; | 237 match = false; |
238 break; | 238 break; |
239 } | 239 } |
240 } | 240 } |
241 EXPECT_TRUE(match); | 241 EXPECT_TRUE(match); |
242 } | 242 } |
243 | 243 |
244 TEST(GIFImageDecoderTest, allDataReceivedTruncation) | |
245 { | |
246 OwnPtr<GIFImageDecoder> decoder(createDecoder()); | |
247 | |
248 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/ani mated.gif"); | |
249 ASSERT_TRUE(data.get()); | |
250 | |
251 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz e() - 10); | |
Peter Kasting
2013/04/23 21:43:20
Maybe we should ASSERT_GE(data->size(), 10U) befor
Alpha Left Google
2013/04/25 23:02:44
Done.
| |
252 decoder->setData(tempData.get(), true); | |
253 | |
254 EXPECT_EQ(2u, decoder->frameCount()); | |
255 EXPECT_FALSE(decoder->failed()); | |
256 | |
257 decoder->frameBufferAtIndex(0); | |
258 EXPECT_FALSE(decoder->failed()); | |
259 decoder->frameBufferAtIndex(1); | |
260 EXPECT_TRUE(decoder->failed()); | |
261 } | |
262 | |
263 TEST(GIFImageDecoderTest, frameIsComplete) | |
264 { | |
265 OwnPtr<GIFImageDecoder> decoder(createDecoder()); | |
266 | |
267 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/ani mated.gif"); | |
268 ASSERT_TRUE(data.get()); | |
269 decoder->setData(data.get(), true); | |
270 | |
271 EXPECT_EQ(2u, decoder->frameCount()); | |
272 EXPECT_FALSE(decoder->failed()); | |
273 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | |
274 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); | |
275 } | |
276 | |
277 TEST(GIFImageDecoderTest, frameIsCompleteLoading) | |
278 { | |
279 OwnPtr<GIFImageDecoder> decoder(createDecoder()); | |
280 | |
281 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/ani mated.gif"); | |
282 ASSERT_TRUE(data.get()); | |
283 | |
284 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz e() - 10); | |
285 decoder->setData(tempData.get(), false); | |
286 | |
287 EXPECT_EQ(2u, decoder->frameCount()); | |
288 EXPECT_FALSE(decoder->failed()); | |
289 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | |
290 EXPECT_FALSE(decoder->frameIsCompleteAtIndex(1)); | |
291 | |
292 decoder->setData(data.get(), true); | |
293 EXPECT_EQ(2u, decoder->frameCount()); | |
294 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | |
295 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); | |
296 } | |
297 | |
244 #endif | 298 #endif |
245 | 299 |
246 } // namespace | 300 } // namespace |
OLD | NEW |