| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // Helper methods to generate standard sizes. | 41 // Helper methods to generate standard sizes. |
| 42 SkISize fullSize() { return SkISize::Make(100, 100); } | 42 SkISize fullSize() { return SkISize::Make(100, 100); } |
| 43 | 43 |
| 44 SkImageInfo imageInfo() | 44 SkImageInfo imageInfo() |
| 45 { | 45 { |
| 46 SkImageInfo info; | 46 return SkImageInfo::Make(100, 100, kBGRA_8888_SkColorType, kOpaque_SkAlphaTy
pe); |
| 47 info.fWidth = 100; | |
| 48 info.fHeight = 100; | |
| 49 info.fColorType = kBGRA_8888_SkColorType; | |
| 50 info.fAlphaType = kOpaque_SkAlphaType; | |
| 51 return info; | |
| 52 } | 47 } |
| 53 | 48 |
| 54 } // namespace | 49 } // namespace |
| 55 | 50 |
| 56 class ImageFrameGeneratorTest : public ::testing::Test, public MockImageDecoderC
lient { | 51 class ImageFrameGeneratorTest : public ::testing::Test, public MockImageDecoderC
lient { |
| 57 public: | 52 public: |
| 58 virtual void SetUp() OVERRIDE | 53 virtual void SetUp() OVERRIDE |
| 59 { | 54 { |
| 60 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); | 55 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); |
| 61 m_data = SharedBuffer::create(); | 56 m_data = SharedBuffer::create(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 static_cast<MockImageDecoder*>(tempDecoder)->setFrameHasAlpha(false); | 189 static_cast<MockImageDecoder*>(tempDecoder)->setFrameHasAlpha(false); |
| 195 ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), tempDecoder
); | 190 ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), tempDecoder
); |
| 196 | 191 |
| 197 setFrameStatus(ImageFrame::FrameComplete); | 192 setFrameStatus(ImageFrame::FrameComplete); |
| 198 m_generator->decodeAndScale(imageInfo(), 1, buffer, 100 * 4); | 193 m_generator->decodeAndScale(imageInfo(), 1, buffer, 100 * 4); |
| 199 EXPECT_EQ(2, m_frameBufferRequestCount); | 194 EXPECT_EQ(2, m_frameBufferRequestCount); |
| 200 EXPECT_FALSE(m_generator->hasAlpha(1)); | 195 EXPECT_FALSE(m_generator->hasAlpha(1)); |
| 201 } | 196 } |
| 202 | 197 |
| 203 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |