| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ImageDecodingStore::Instance().SetCacheLimitInBytes(1024 * 1024); | 105 ImageDecodingStore::Instance().SetCacheLimitInBytes(1024 * 1024); |
| 106 data_ = SharedBuffer::Create(kWhitePNG, sizeof(kWhitePNG)); | 106 data_ = SharedBuffer::Create(kWhitePNG, sizeof(kWhitePNG)); |
| 107 frame_count_ = 1; | 107 frame_count_ = 1; |
| 108 std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::Create(this); | 108 std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::Create(this); |
| 109 actual_decoder_ = decoder.get(); | 109 actual_decoder_ = decoder.get(); |
| 110 actual_decoder_->SetSize(1, 1); | 110 actual_decoder_->SetSize(1, 1); |
| 111 lazy_decoder_ = DeferredImageDecoder::CreateForTesting(std::move(decoder)); | 111 lazy_decoder_ = DeferredImageDecoder::CreateForTesting(std::move(decoder)); |
| 112 bitmap_.allocPixels(SkImageInfo::MakeN32Premul(100, 100)); | 112 bitmap_.allocPixels(SkImageInfo::MakeN32Premul(100, 100)); |
| 113 canvas_ = base::MakeUnique<cc::SkiaPaintCanvas>(bitmap_); | 113 canvas_ = base::MakeUnique<cc::SkiaPaintCanvas>(bitmap_); |
| 114 decode_request_count_ = 0; | 114 decode_request_count_ = 0; |
| 115 repetition_count_ = kAnimationNone; | 115 repetition_count_ = kCAnimationNone; |
| 116 status_ = ImageFrame::kFrameComplete; | 116 status_ = ImageFrame::kFrameComplete; |
| 117 frame_duration_ = 0; | 117 frame_duration_ = 0; |
| 118 decoded_size_ = actual_decoder_->Size(); | 118 decoded_size_ = actual_decoder_->Size(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void TearDown() override { ImageDecodingStore::Instance().Clear(); } | 121 void TearDown() override { ImageDecodingStore::Instance().Clear(); } |
| 122 | 122 |
| 123 void DecoderBeingDestroyed() override { actual_decoder_ = 0; } | 123 void DecoderBeingDestroyed() override { actual_decoder_ = 0; } |
| 124 | 124 |
| 125 void DecodeRequested() override { ++decode_request_count_; } | 125 void DecodeRequested() override { ++decode_request_count_; } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 SharedBuffer::Create(data_->Data(), data_->size()); | 383 SharedBuffer::Create(data_->Data(), data_->size()); |
| 384 EXPECT_EQ(original_data->size(), data_->size()); | 384 EXPECT_EQ(original_data->size(), data_->size()); |
| 385 lazy_decoder_->SetData(original_data, false); | 385 lazy_decoder_->SetData(original_data, false); |
| 386 RefPtr<SharedBuffer> new_data = lazy_decoder_->Data(); | 386 RefPtr<SharedBuffer> new_data = lazy_decoder_->Data(); |
| 387 EXPECT_EQ(original_data->size(), new_data->size()); | 387 EXPECT_EQ(original_data->size(), new_data->size()); |
| 388 EXPECT_EQ(0, std::memcmp(original_data->Data(), new_data->Data(), | 388 EXPECT_EQ(0, std::memcmp(original_data->Data(), new_data->Data(), |
| 389 new_data->size())); | 389 new_data->size())); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace blink | 392 } // namespace blink |
| OLD | NEW |