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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 CanvasContextCreationAttributes attributes; | 213 CanvasContextCreationAttributes attributes; |
214 CanvasRenderingContext2DOrWebGLRenderingContext context; | 214 CanvasRenderingContext2DOrWebGLRenderingContext context; |
215 canvasElement->getContext("2d", attributes, context); | 215 canvasElement->getContext("2d", attributes, context); |
216 TrackExceptionState exceptionState; | 216 TrackExceptionState exceptionState; |
217 CanvasImageSourceUnion imageSource; | 217 CanvasImageSourceUnion imageSource; |
218 imageSource.setImageBitmap(imageBitmapDerived); | 218 imageSource.setImageBitmap(imageBitmapDerived); |
219 context.getAsCanvasRenderingContext2D()->drawImage(imageSource, 0, 0, except
ionState); | 219 context.getAsCanvasRenderingContext2D()->drawImage(imageSource, 0, 0, except
ionState); |
220 } | 220 } |
221 | 221 |
222 } // namespace | 222 } // namespace |
OLD | NEW |