OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 m_lazyDecoder->setData(*m_data, false); | 402 m_lazyDecoder->setData(*m_data, false); |
403 m_lazyDecoder->createFrameAtIndex(0); | 403 m_lazyDecoder->createFrameAtIndex(0); |
404 m_lazyDecoder->createFrameAtIndex(1); | 404 m_lazyDecoder->createFrameAtIndex(1); |
405 m_lazyDecoder->setData(*m_data, true); | 405 m_lazyDecoder->setData(*m_data, true); |
406 // Clears only the first frame (0 bytes). If DeferredImageDecoder doesn't | 406 // Clears only the first frame (0 bytes). If DeferredImageDecoder doesn't |
407 // check with the actual decoder it reports 4 bytes instead. | 407 // check with the actual decoder it reports 4 bytes instead. |
408 size_t frameBytesCleared = m_lazyDecoder->clearCacheExceptFrame(1); | 408 size_t frameBytesCleared = m_lazyDecoder->clearCacheExceptFrame(1); |
409 EXPECT_EQ(static_cast<size_t>(0), frameBytesCleared); | 409 EXPECT_EQ(static_cast<size_t>(0), frameBytesCleared); |
410 } | 410 } |
411 | 411 |
| 412 TEST_F(DeferredImageDecoderTest, data) |
| 413 { |
| 414 RefPtr<SharedBuffer> originalData = SharedBuffer::create(m_data->data(), m_d
ata->size()); |
| 415 EXPECT_EQ(originalData->size(), m_data->size()); |
| 416 m_lazyDecoder->setData(*originalData, false); |
| 417 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); |
| 418 EXPECT_EQ(originalData->size(), newData->size()); |
| 419 EXPECT_EQ(0, std::memcmp(originalData->data(), newData->data(), newData->siz
e())); |
| 420 } |
| 421 |
412 } // namespace blink | 422 } // namespace blink |
OLD | NEW |