| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), | 107 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), |
| 108 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); | 108 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); |
| 109 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), | 109 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), |
| 110 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); | 110 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); |
| 111 | 111 |
| 112 StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage(); | 112 StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage(); |
| 113 ASSERT_NE(emptyImage->imageForCurrentFrame(), | 113 ASSERT_NE(emptyImage->imageForCurrentFrame(), |
| 114 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); | 114 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a referenc
e to the original Image if the HTMLImageElement src is changed. | 117 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a |
| 118 // reference to the original Image if the HTMLImageElement src is changed. |
| 118 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) { | 119 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) { |
| 119 HTMLImageElement* image = HTMLImageElement::create(*Document::create()); | 120 HTMLImageElement* image = HTMLImageElement::create(*Document::create()); |
| 120 ImageResource* originalImageResource = | 121 ImageResource* originalImageResource = |
| 121 ImageResource::create(StaticBitmapImage::create(m_image).get()); | 122 ImageResource::create(StaticBitmapImage::create(m_image).get()); |
| 122 image->setImageResource(originalImageResource); | 123 image->setImageResource(originalImageResource); |
| 123 | 124 |
| 124 const ImageBitmapOptions defaultOptions; | 125 const ImageBitmapOptions defaultOptions; |
| 125 Optional<IntRect> cropRect = | 126 Optional<IntRect> cropRect = |
| 126 IntRect(0, 0, m_image->width(), m_image->height()); | 127 IntRect(0, 0, m_image->width(), m_image->height()); |
| 127 ImageBitmap* imageBitmap = ImageBitmap::create( | 128 ImageBitmap* imageBitmap = ImageBitmap::create( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 151 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get(); | 152 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get(); |
| 152 ASSERT_NE(image1, nullptr); | 153 ASSERT_NE(image1, nullptr); |
| 153 SkImage* image2 = | 154 SkImage* image2 = |
| 154 newImageResource->getImage()->imageForCurrentFrame().get(); | 155 newImageResource->getImage()->imageForCurrentFrame().get(); |
| 155 ASSERT_NE(image2, nullptr); | 156 ASSERT_NE(image2, nullptr); |
| 156 ASSERT_NE(image1, image2); | 157 ASSERT_NE(image1, image2); |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |