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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 RefPtr<SharedBuffer> m_data; | 141 RefPtr<SharedBuffer> m_data; |
142 size_t m_frameCount; | 142 size_t m_frameCount; |
143 int m_repetitionCount; | 143 int m_repetitionCount; |
144 ImageFrame::Status m_status; | 144 ImageFrame::Status m_status; |
145 float m_frameDuration; | 145 float m_frameDuration; |
146 IntSize m_decodedSize; | 146 IntSize m_decodedSize; |
147 }; | 147 }; |
148 | 148 |
149 TEST_F(DeferredImageDecoderTest, drawIntoSkPicture) | 149 TEST_F(DeferredImageDecoderTest, drawIntoSkPicture) |
150 { | 150 { |
151 m_lazyDecoder->setData(m_data.get(), true); | 151 m_lazyDecoder->setData(*m_data, true); |
152 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); | 152 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); |
153 EXPECT_EQ(1, image->bitmap().width()); | 153 EXPECT_EQ(1, image->bitmap().width()); |
154 EXPECT_EQ(1, image->bitmap().height()); | 154 EXPECT_EQ(1, image->bitmap().height()); |
155 EXPECT_FALSE(image->bitmap().isNull()); | 155 EXPECT_FALSE(image->bitmap().isNull()); |
156 EXPECT_TRUE(image->bitmap().isImmutable()); | 156 EXPECT_TRUE(image->bitmap().isImmutable()); |
157 | 157 |
158 SkPictureRecorder recorder; | 158 SkPictureRecorder recorder; |
159 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); | 159 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); |
160 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 160 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
161 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 161 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
162 EXPECT_EQ(0, m_frameBufferRequestCount); | 162 EXPECT_EQ(0, m_frameBufferRequestCount); |
163 | 163 |
164 m_canvas->drawPicture(*picture); | 164 m_canvas->drawPicture(*picture); |
165 EXPECT_EQ(0, m_frameBufferRequestCount); | 165 EXPECT_EQ(0, m_frameBufferRequestCount); |
166 | 166 |
167 SkBitmap canvasBitmap; | 167 SkBitmap canvasBitmap; |
168 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); | 168 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); |
169 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); | 169 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); |
170 SkAutoLockPixels autoLock(canvasBitmap); | 170 SkAutoLockPixels autoLock(canvasBitmap); |
171 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); | 171 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); |
172 } | 172 } |
173 | 173 |
174 TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive) | 174 TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive) |
175 { | 175 { |
176 RefPtr<SharedBuffer> partialData = SharedBuffer::create(m_data->data(), m_da
ta->size() - 10); | 176 RefPtr<SharedBuffer> partialData = SharedBuffer::create(m_data->data(), m_da
ta->size() - 10); |
177 | 177 |
178 // Received only half the file. | 178 // Received only half the file. |
179 m_lazyDecoder->setData(partialData.get(), false); | 179 m_lazyDecoder->setData(*partialData, false); |
180 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); | 180 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); |
181 SkPictureRecorder recorder; | 181 SkPictureRecorder recorder; |
182 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); | 182 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); |
183 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 183 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
184 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 184 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
185 m_canvas->drawPicture(*picture); | 185 m_canvas->drawPicture(*picture); |
186 | 186 |
187 // Fully received the file and draw the SkPicture again. | 187 // Fully received the file and draw the SkPicture again. |
188 m_lazyDecoder->setData(m_data.get(), true); | 188 m_lazyDecoder->setData(*m_data, true); |
189 image = m_lazyDecoder->frameBufferAtIndex(0)->asNewNativeImage(); | 189 image = m_lazyDecoder->frameBufferAtIndex(0)->asNewNativeImage(); |
190 tempCanvas = recorder.beginRecording(100, 100); | 190 tempCanvas = recorder.beginRecording(100, 100); |
191 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 191 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
192 picture = adoptRef(recorder.endRecording()); | 192 picture = adoptRef(recorder.endRecording()); |
193 m_canvas->drawPicture(*picture); | 193 m_canvas->drawPicture(*picture); |
194 | 194 |
195 SkBitmap canvasBitmap; | 195 SkBitmap canvasBitmap; |
196 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); | 196 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); |
197 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); | 197 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); |
198 SkAutoLockPixels autoLock(canvasBitmap); | 198 SkAutoLockPixels autoLock(canvasBitmap); |
199 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); | 199 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); |
200 } | 200 } |
201 | 201 |
202 static void rasterizeMain(SkCanvas* canvas, SkPicture* picture) | 202 static void rasterizeMain(SkCanvas* canvas, SkPicture* picture) |
203 { | 203 { |
204 canvas->drawPicture(*picture); | 204 canvas->drawPicture(*picture); |
205 } | 205 } |
206 | 206 |
207 TEST_F(DeferredImageDecoderTest, decodeOnOtherThread) | 207 TEST_F(DeferredImageDecoderTest, decodeOnOtherThread) |
208 { | 208 { |
209 m_lazyDecoder->setData(m_data.get(), true); | 209 m_lazyDecoder->setData(*m_data, true); |
210 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); | 210 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); |
211 EXPECT_EQ(1, image->bitmap().width()); | 211 EXPECT_EQ(1, image->bitmap().width()); |
212 EXPECT_EQ(1, image->bitmap().height()); | 212 EXPECT_EQ(1, image->bitmap().height()); |
213 EXPECT_FALSE(image->bitmap().isNull()); | 213 EXPECT_FALSE(image->bitmap().isNull()); |
214 EXPECT_TRUE(image->bitmap().isImmutable()); | 214 EXPECT_TRUE(image->bitmap().isImmutable()); |
215 | 215 |
216 SkPictureRecorder recorder; | 216 SkPictureRecorder recorder; |
217 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); | 217 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); |
218 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 218 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
219 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 219 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
220 EXPECT_EQ(0, m_frameBufferRequestCount); | 220 EXPECT_EQ(0, m_frameBufferRequestCount); |
221 | 221 |
222 // Create a thread to rasterize SkPicture. | 222 // Create a thread to rasterize SkPicture. |
223 OwnPtr<blink::WebThread> thread = adoptPtr(blink::Platform::current()->creat
eThread("RasterThread")); | 223 OwnPtr<blink::WebThread> thread = adoptPtr(blink::Platform::current()->creat
eThread("RasterThread")); |
224 thread->postTask(new Task(WTF::bind(&rasterizeMain, m_canvas.get(), picture.
get()))); | 224 thread->postTask(new Task(WTF::bind(&rasterizeMain, m_canvas.get(), picture.
get()))); |
225 thread.clear(); | 225 thread.clear(); |
226 EXPECT_EQ(0, m_frameBufferRequestCount); | 226 EXPECT_EQ(0, m_frameBufferRequestCount); |
227 | 227 |
228 SkBitmap canvasBitmap; | 228 SkBitmap canvasBitmap; |
229 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); | 229 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); |
230 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); | 230 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); |
231 SkAutoLockPixels autoLock(canvasBitmap); | 231 SkAutoLockPixels autoLock(canvasBitmap); |
232 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); | 232 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); |
233 } | 233 } |
234 | 234 |
235 TEST_F(DeferredImageDecoderTest, singleFrameImageLoading) | 235 TEST_F(DeferredImageDecoderTest, singleFrameImageLoading) |
236 { | 236 { |
237 m_status = ImageFrame::FramePartial; | 237 m_status = ImageFrame::FramePartial; |
238 m_lazyDecoder->setData(m_data.get(), false); | 238 m_lazyDecoder->setData(*m_data, false); |
239 EXPECT_FALSE(m_lazyDecoder->frameIsCompleteAtIndex(0)); | 239 EXPECT_FALSE(m_lazyDecoder->frameIsCompleteAtIndex(0)); |
240 ImageFrame* frame = m_lazyDecoder->frameBufferAtIndex(0); | 240 ImageFrame* frame = m_lazyDecoder->frameBufferAtIndex(0); |
241 unsigned firstId = frame->getSkBitmap().getGenerationID(); | 241 unsigned firstId = frame->getSkBitmap().getGenerationID(); |
242 EXPECT_EQ(ImageFrame::FramePartial, frame->status()); | 242 EXPECT_EQ(ImageFrame::FramePartial, frame->status()); |
243 EXPECT_TRUE(m_actualDecoder); | 243 EXPECT_TRUE(m_actualDecoder); |
244 | 244 |
245 m_status = ImageFrame::FrameComplete; | 245 m_status = ImageFrame::FrameComplete; |
246 m_data->append(" ", 1); | 246 m_data->append(" ", 1); |
247 m_lazyDecoder->setData(m_data.get(), true); | 247 m_lazyDecoder->setData(*m_data, true); |
248 EXPECT_FALSE(m_actualDecoder); | 248 EXPECT_FALSE(m_actualDecoder); |
249 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); | 249 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); |
250 frame = m_lazyDecoder->frameBufferAtIndex(0); | 250 frame = m_lazyDecoder->frameBufferAtIndex(0); |
251 unsigned secondId = frame->getSkBitmap().getGenerationID(); | 251 unsigned secondId = frame->getSkBitmap().getGenerationID(); |
252 EXPECT_EQ(ImageFrame::FrameComplete, frame->status()); | 252 EXPECT_EQ(ImageFrame::FrameComplete, frame->status()); |
253 EXPECT_FALSE(m_frameBufferRequestCount); | 253 EXPECT_FALSE(m_frameBufferRequestCount); |
254 EXPECT_NE(firstId, secondId); | 254 EXPECT_NE(firstId, secondId); |
255 | 255 |
256 EXPECT_EQ(secondId, m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID()); | 256 EXPECT_EQ(secondId, m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID()); |
257 } | 257 } |
258 | 258 |
259 TEST_F(DeferredImageDecoderTest, multiFrameImageLoading) | 259 TEST_F(DeferredImageDecoderTest, multiFrameImageLoading) |
260 { | 260 { |
261 m_repetitionCount = 10; | 261 m_repetitionCount = 10; |
262 m_frameCount = 1; | 262 m_frameCount = 1; |
263 m_frameDuration = 10; | 263 m_frameDuration = 10; |
264 m_status = ImageFrame::FramePartial; | 264 m_status = ImageFrame::FramePartial; |
265 m_lazyDecoder->setData(m_data.get(), false); | 265 m_lazyDecoder->setData(*m_data, false); |
266 EXPECT_EQ(ImageFrame::FramePartial, m_lazyDecoder->frameBufferAtIndex(0)->st
atus()); | 266 EXPECT_EQ(ImageFrame::FramePartial, m_lazyDecoder->frameBufferAtIndex(0)->st
atus()); |
267 unsigned firstId = m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getGe
nerationID(); | 267 unsigned firstId = m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getGe
nerationID(); |
268 EXPECT_FALSE(m_lazyDecoder->frameIsCompleteAtIndex(0)); | 268 EXPECT_FALSE(m_lazyDecoder->frameIsCompleteAtIndex(0)); |
269 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); | 269 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); |
270 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); | 270 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); |
271 | 271 |
272 m_frameCount = 2; | 272 m_frameCount = 2; |
273 m_frameDuration = 20; | 273 m_frameDuration = 20; |
274 m_status = ImageFrame::FrameComplete; | 274 m_status = ImageFrame::FrameComplete; |
275 m_data->append(" ", 1); | 275 m_data->append(" ", 1); |
276 m_lazyDecoder->setData(m_data.get(), false); | 276 m_lazyDecoder->setData(*m_data, false); |
277 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(0)->s
tatus()); | 277 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(0)->s
tatus()); |
278 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(1)->s
tatus()); | 278 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(1)->s
tatus()); |
279 unsigned secondId = m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID(); | 279 unsigned secondId = m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID(); |
280 EXPECT_NE(firstId, secondId); | 280 EXPECT_NE(firstId, secondId); |
281 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); | 281 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); |
282 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(1)); | 282 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(1)); |
283 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); | 283 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); |
284 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); | 284 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); |
285 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); | 285 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); |
286 EXPECT_TRUE(m_actualDecoder); | 286 EXPECT_TRUE(m_actualDecoder); |
287 | 287 |
288 m_frameCount = 3; | 288 m_frameCount = 3; |
289 m_frameDuration = 30; | 289 m_frameDuration = 30; |
290 m_status = ImageFrame::FrameComplete; | 290 m_status = ImageFrame::FrameComplete; |
291 m_lazyDecoder->setData(m_data.get(), true); | 291 m_lazyDecoder->setData(*m_data, true); |
292 EXPECT_FALSE(m_actualDecoder); | 292 EXPECT_FALSE(m_actualDecoder); |
293 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(0)->s
tatus()); | 293 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(0)->s
tatus()); |
294 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(1)->s
tatus()); | 294 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(1)->s
tatus()); |
295 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(2)->s
tatus()); | 295 EXPECT_EQ(ImageFrame::FrameComplete, m_lazyDecoder->frameBufferAtIndex(2)->s
tatus()); |
296 EXPECT_EQ(secondId, m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID()); | 296 EXPECT_EQ(secondId, m_lazyDecoder->frameBufferAtIndex(0)->getSkBitmap().getG
enerationID()); |
297 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); | 297 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(0)); |
298 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(1)); | 298 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(1)); |
299 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(2)); | 299 EXPECT_TRUE(m_lazyDecoder->frameIsCompleteAtIndex(2)); |
300 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); | 300 EXPECT_EQ(10.0f, m_lazyDecoder->frameDurationAtIndex(0)); |
301 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); | 301 EXPECT_EQ(20.0f, m_lazyDecoder->frameDurationAtIndex(1)); |
302 EXPECT_EQ(30.0f, m_lazyDecoder->frameDurationAtIndex(2)); | 302 EXPECT_EQ(30.0f, m_lazyDecoder->frameDurationAtIndex(2)); |
303 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); | 303 EXPECT_EQ(10.0f, m_lazyDecoder->frameBufferAtIndex(0)->duration()); |
304 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); | 304 EXPECT_EQ(20.0f, m_lazyDecoder->frameBufferAtIndex(1)->duration()); |
305 EXPECT_EQ(30.0f, m_lazyDecoder->frameBufferAtIndex(2)->duration()); | 305 EXPECT_EQ(30.0f, m_lazyDecoder->frameBufferAtIndex(2)->duration()); |
306 EXPECT_EQ(10, m_lazyDecoder->repetitionCount()); | 306 EXPECT_EQ(10, m_lazyDecoder->repetitionCount()); |
307 } | 307 } |
308 | 308 |
309 TEST_F(DeferredImageDecoderTest, decodedSize) | 309 TEST_F(DeferredImageDecoderTest, decodedSize) |
310 { | 310 { |
311 m_decodedSize = IntSize(22, 33); | 311 m_decodedSize = IntSize(22, 33); |
312 m_lazyDecoder->setData(m_data.get(), true); | 312 m_lazyDecoder->setData(*m_data, true); |
313 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); | 313 RefPtr<NativeImageSkia> image = m_lazyDecoder->frameBufferAtIndex(0)->asNewN
ativeImage(); |
314 EXPECT_EQ(m_decodedSize.width(), image->bitmap().width()); | 314 EXPECT_EQ(m_decodedSize.width(), image->bitmap().width()); |
315 EXPECT_EQ(m_decodedSize.height(), image->bitmap().height()); | 315 EXPECT_EQ(m_decodedSize.height(), image->bitmap().height()); |
316 EXPECT_FALSE(image->bitmap().isNull()); | 316 EXPECT_FALSE(image->bitmap().isNull()); |
317 EXPECT_TRUE(image->bitmap().isImmutable()); | 317 EXPECT_TRUE(image->bitmap().isImmutable()); |
318 | 318 |
319 useMockImageDecoderFactory(); | 319 useMockImageDecoderFactory(); |
320 | 320 |
321 // The following code should not fail any assert. | 321 // The following code should not fail any assert. |
322 SkPictureRecorder recorder; | 322 SkPictureRecorder recorder; |
323 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); | 323 SkCanvas* tempCanvas = recorder.beginRecording(100, 100); |
324 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 324 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
325 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 325 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
326 EXPECT_EQ(0, m_frameBufferRequestCount); | 326 EXPECT_EQ(0, m_frameBufferRequestCount); |
327 m_canvas->drawPicture(*picture); | 327 m_canvas->drawPicture(*picture); |
328 EXPECT_EQ(1, m_frameBufferRequestCount); | 328 EXPECT_EQ(1, m_frameBufferRequestCount); |
329 } | 329 } |
330 | 330 |
331 TEST_F(DeferredImageDecoderTest, smallerFrameCount) | 331 TEST_F(DeferredImageDecoderTest, smallerFrameCount) |
332 { | 332 { |
333 m_frameCount = 1; | 333 m_frameCount = 1; |
334 m_lazyDecoder->setData(m_data.get(), false); | 334 m_lazyDecoder->setData(*m_data, false); |
335 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 335 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
336 m_frameCount = 2; | 336 m_frameCount = 2; |
337 m_lazyDecoder->setData(m_data.get(), false); | 337 m_lazyDecoder->setData(*m_data, false); |
338 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 338 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
339 m_frameCount = 0; | 339 m_frameCount = 0; |
340 m_lazyDecoder->setData(m_data.get(), true); | 340 m_lazyDecoder->setData(*m_data, true); |
341 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 341 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
342 } | 342 } |
343 | 343 |
344 } // namespace WebCore | 344 } // namespace WebCore |
OLD | NEW |