Chromium Code Reviews| 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 virtual size_t frameCount() | 105 virtual size_t frameCount() |
| 106 { | 106 { |
| 107 return m_frameCount; | 107 return m_frameCount; |
| 108 } | 108 } |
| 109 | 109 |
| 110 virtual int repetitionCount() const | 110 virtual int repetitionCount() const |
| 111 { | 111 { |
| 112 return m_repetitionCount; | 112 return m_repetitionCount; |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual ImageFrame::FrameStatus frameStatus() | 115 virtual ImageFrame::Status frameStatus() |
| 116 { | 116 { |
| 117 return m_frameStatus; | 117 return m_frameStatus; |
| 118 } | 118 } |
| 119 | 119 |
| 120 virtual float frameDuration() const | 120 virtual float frameDuration() const |
| 121 { | 121 { |
| 122 return m_frameDuration; | 122 return m_frameDuration; |
| 123 } | 123 } |
| 124 | 124 |
| 125 protected: | 125 protected: |
| 126 // Don't own this but saves the pointer to query states. | 126 // Don't own this but saves the pointer to query states. |
| 127 MockImageDecoder* m_actualDecoder; | 127 MockImageDecoder* m_actualDecoder; |
| 128 OwnPtr<DeferredImageDecoder> m_lazyDecoder; | 128 OwnPtr<DeferredImageDecoder> m_lazyDecoder; |
| 129 SkPicture m_picture; | 129 SkPicture m_picture; |
| 130 SkAutoTUnref<SkCanvas> m_canvas; | 130 SkAutoTUnref<SkCanvas> m_canvas; |
| 131 int m_frameBufferRequestCount; | 131 int m_frameBufferRequestCount; |
| 132 RefPtr<SharedBuffer> m_data; | 132 RefPtr<SharedBuffer> m_data; |
| 133 size_t m_frameCount; | 133 size_t m_frameCount; |
| 134 int m_repetitionCount; | 134 int m_repetitionCount; |
| 135 ImageFrame::FrameStatus m_frameStatus; | 135 ImageFrame::Status m_frameStatus; |
|
Peter Kasting
2013/08/23 01:14:02
Nit: Name this m_status (same everywhere else in t
urvang (Google)
2013/08/23 02:34:31
Done.
| |
| 136 float m_frameDuration; | 136 float m_frameDuration; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 TEST_F(DeferredImageDecoderTest, drawIntoSkPicture) | 139 TEST_F(DeferredImageDecoderTest, drawIntoSkPicture) |
| 140 { | 140 { |
| 141 m_lazyDecoder->setData(m_data.get(), true); | 141 m_lazyDecoder->setData(m_data.get(), true); |
| 142 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN ativeImage(); | 142 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN ativeImage(); |
| 143 EXPECT_EQ(1, image->bitmap().width()); | 143 EXPECT_EQ(1, image->bitmap().width()); |
| 144 EXPECT_EQ(1, image->bitmap().height()); | 144 EXPECT_EQ(1, image->bitmap().height()); |
| 145 EXPECT_FALSE(image->bitmap().isNull()); | 145 EXPECT_FALSE(image->bitmap().isNull()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); | 279 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); |
| 280 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); | 280 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); |
| 281 EXPECT_EQ(30.0f, m_lazyDecoder->frameDurationAtIndex(2)); | 281 EXPECT_EQ(30.0f, m_lazyDecoder->frameDurationAtIndex(2)); |
| 282 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); | 282 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); |
| 283 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); | 283 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); |
| 284 EXPECT_EQ(30.0f, m_lazyDecoder->frameBufferAtIndex(2)->duration()); | 284 EXPECT_EQ(30.0f, m_lazyDecoder->frameBufferAtIndex(2)->duration()); |
| 285 EXPECT_EQ(10, m_lazyDecoder->repetitionCount()); | 285 EXPECT_EQ(10, m_lazyDecoder->repetitionCount()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace | 288 } // namespace |
| OLD | NEW |