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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return info; | 51 return info; |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 class ImageFrameGeneratorTest : public ::testing::Test, public MockImageDecoderC
lient { | 56 class ImageFrameGeneratorTest : public ::testing::Test, public MockImageDecoderC
lient { |
57 public: | 57 public: |
58 virtual void SetUp() OVERRIDE | 58 virtual void SetUp() OVERRIDE |
59 { | 59 { |
60 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); | 60 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); |
61 ImageDecodingStore::instance()->setImageCachingEnabled(true); | |
62 m_data = SharedBuffer::create(); | 61 m_data = SharedBuffer::create(); |
63 m_generator = ImageFrameGenerator::create(fullSize(), m_data, false); | 62 m_generator = ImageFrameGenerator::create(fullSize(), m_data, false); |
64 useMockImageDecoderFactory(); | 63 useMockImageDecoderFactory(); |
65 m_decodersDestroyed = 0; | 64 m_decodersDestroyed = 0; |
66 m_frameBufferRequestCount = 0; | 65 m_frameBufferRequestCount = 0; |
67 m_status = ImageFrame::FrameEmpty; | 66 m_status = ImageFrame::FrameEmpty; |
68 } | 67 } |
69 | 68 |
70 virtual void TearDown() OVERRIDE | 69 virtual void TearDown() OVERRIDE |
71 { | 70 { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 static_cast<MockImageDecoder*>(tempDecoder)->setFrameHasAlpha(false); | 194 static_cast<MockImageDecoder*>(tempDecoder)->setFrameHasAlpha(false); |
196 ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), tempDecoder
); | 195 ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), tempDecoder
); |
197 | 196 |
198 setFrameStatus(ImageFrame::FrameComplete); | 197 setFrameStatus(ImageFrame::FrameComplete); |
199 m_generator->decodeAndScale(imageInfo(), 1, buffer, 100 * 4); | 198 m_generator->decodeAndScale(imageInfo(), 1, buffer, 100 * 4); |
200 EXPECT_EQ(2, m_frameBufferRequestCount); | 199 EXPECT_EQ(2, m_frameBufferRequestCount); |
201 EXPECT_FALSE(m_generator->hasAlpha(1)); | 200 EXPECT_FALSE(m_generator->hasAlpha(1)); |
202 } | 201 } |
203 | 202 |
204 } // namespace blink | 203 } // namespace blink |
OLD | NEW |