OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 { | 69 { |
70 // Garbage collection is required prior to switching out the | 70 // Garbage collection is required prior to switching out the |
71 // test's memory cache; image resources are released, evicting | 71 // test's memory cache; image resources are released, evicting |
72 // them from the cache. | 72 // them from the cache. |
73 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC
WithSweep, Heap::ForcedGC); | 73 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC
WithSweep, Heap::ForcedGC); |
74 | 74 |
75 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); | 75 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); |
76 } | 76 } |
77 | 77 |
78 SkBitmap m_bitmap, m_bitmap2; | 78 SkBitmap m_bitmap, m_bitmap2; |
79 OwnPtrWillBePersistent<MemoryCache> m_globalMemoryCache; | 79 Persistent<MemoryCache> m_globalMemoryCache; |
80 }; | 80 }; |
81 | 81 |
82 // Verifies that the image resource held by an ImageBitmap is the same as the | 82 // Verifies that the image resource held by an ImageBitmap is the same as the |
83 // one held by the HTMLImageElement. | 83 // one held by the HTMLImageElement. |
84 TEST_F(ImageBitmapTest, ImageResourceConsistency) | 84 TEST_F(ImageBitmapTest, ImageResourceConsistency) |
85 { | 85 { |
86 RefPtrWillBeRawPtr<HTMLImageElement> imageElement = HTMLImageElement::create
(*Document::create().get()); | 86 RefPtrWillBeRawPtr<HTMLImageElement> imageElement = HTMLImageElement::create
(*Document::create().get()); |
87 imageElement->setImageResource(new ImageResource(BitmapImage::create(m_bitma
p).get())); | 87 imageElement->setImageResource(new ImageResource(BitmapImage::create(m_bitma
p).get())); |
88 | 88 |
89 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imag
eElement.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height())); | 89 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imag
eElement.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height())); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 CanvasContextCreationAttributes attributes; | 213 CanvasContextCreationAttributes attributes; |
214 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(c
anvasElement->getCanvasRenderingContext("2d", attributes)); | 214 CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(c
anvasElement->getCanvasRenderingContext("2d", attributes)); |
215 TrackExceptionState exceptionState; | 215 TrackExceptionState exceptionState; |
216 CanvasImageSourceUnion imageSource; | 216 CanvasImageSourceUnion imageSource; |
217 imageSource.setImageBitmap(imageBitmapDerived); | 217 imageSource.setImageBitmap(imageBitmapDerived); |
218 context->drawImage(imageSource, 0, 0, exceptionState); | 218 context->drawImage(imageSource, 0, 0, exceptionState); |
219 } | 219 } |
220 | 220 |
221 } // namespace | 221 } // namespace |
OLD | NEW |