Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::creat e(imageElement.get(), 91 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::creat e(imageElement.get(),
92 IntRect(m_image->width() / 2, m_image->height() / 2, m_image->width() / 2, m_image->height() / 2), 92 IntRect(m_image->width() / 2, m_image->height() / 2, m_image->width() / 2, m_image->height() / 2),
93 &(imageElement->document()), defaultOptions); 93 &(imageElement->document()), defaultOptions);
94 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::creat e(imageElement.get(), 94 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::creat e(imageElement.get(),
95 IntRect(-m_image->width() / 2, -m_image->height() / 2, m_image->width(), m_image->height()), 95 IntRect(-m_image->width() / 2, -m_image->height() / 2, m_image->width(), m_image->height()),
96 &(imageElement->document()), defaultOptions); 96 &(imageElement->document()), defaultOptions);
97 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create (imageElement.get(), 97 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create (imageElement.get(),
98 IntRect(-m_image->width(), -m_image->height(), m_image->width(), m_image ->height()), 98 IntRect(-m_image->width(), -m_image->height(), m_image->width(), m_image ->height()),
99 &(imageElement->document()), defaultOptions); 99 &(imageElement->document()), defaultOptions);
100 100
101 ASSERT_EQ(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(), imageEle ment->cachedImage()->image()->imageForCurrentFrame()); 101 ASSERT_EQ(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(), imageEle ment->cachedImage()->getImage()->imageForCurrentFrame());
102 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), im ageElement->cachedImage()->image()->imageForCurrentFrame()); 102 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), im ageElement->cachedImage()->getImage()->imageForCurrentFrame());
103 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), im ageElement->cachedImage()->image()->imageForCurrentFrame()); 103 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), im ageElement->cachedImage()->getImage()->imageForCurrentFrame());
104 104
105 StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage(); 105 StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage();
106 ASSERT_NE(emptyImage->imageForCurrentFrame(), imageElement->cachedImage()->i mage()->imageForCurrentFrame()); 106 ASSERT_NE(emptyImage->imageForCurrentFrame(), imageElement->cachedImage()->g etImage()->imageForCurrentFrame());
107 } 107 }
108 108
109 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a referenc e to the original Image if the HTMLImageElement src is changed. 109 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a referenc e to the original Image if the HTMLImageElement src is changed.
110 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) 110 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged)
111 { 111 {
112 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(*Docum ent::create().get()); 112 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(*Docum ent::create().get());
113 RefPtrWillBeRawPtr<ImageResource> originalImageResource = ImageResource::cre ate( 113 RefPtrWillBeRawPtr<ImageResource> originalImageResource = ImageResource::cre ate(
114 StaticBitmapImage::create(m_image).get()); 114 StaticBitmapImage::create(m_image).get());
115 image->setImageResource(originalImageResource.get()); 115 image->setImageResource(originalImageResource.get());
116 116
117 const ImageBitmapOptions defaultOptions; 117 const ImageBitmapOptions defaultOptions;
118 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get( ), 118 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get( ),
119 IntRect(0, 0, m_image->width(), m_image->height()), 119 IntRect(0, 0, m_image->width(), m_image->height()),
120 &(image->document()), defaultOptions); 120 &(image->document()), defaultOptions);
121 ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), originalImageR esource->image()->imageForCurrentFrame()); 121 ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), originalImageR esource->getImage()->imageForCurrentFrame());
122 122
123 RefPtrWillBeRawPtr<ImageResource> newImageResource = ImageResource::create( 123 RefPtrWillBeRawPtr<ImageResource> newImageResource = ImageResource::create(
124 StaticBitmapImage::create(m_image2).get()); 124 StaticBitmapImage::create(m_image2).get());
125 image->setImageResource(newImageResource.get()); 125 image->setImageResource(newImageResource.get());
126 126
127 // The ImageBitmap should contain the same data as the original cached image 127 // The ImageBitmap should contain the same data as the original cached image
128 { 128 {
129 ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), originalIm ageResource->image()->imageForCurrentFrame()); 129 ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), originalIm ageResource->getImage()->imageForCurrentFrame());
130 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get (); 130 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get ();
131 ASSERT_NE(image1, nullptr); 131 ASSERT_NE(image1, nullptr);
132 SkImage* image2 = originalImageResource->image()->imageForCurrentFrame() .get(); 132 SkImage* image2 = originalImageResource->getImage()->imageForCurrentFram e().get();
133 ASSERT_NE(image2, nullptr); 133 ASSERT_NE(image2, nullptr);
134 ASSERT_EQ(image1, image2); 134 ASSERT_EQ(image1, image2);
135 } 135 }
136 136
137 { 137 {
138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe source->image()->imageForCurrentFrame()); 138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe source->getImage()->imageForCurrentFrame());
139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get (); 139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get ();
140 ASSERT_NE(image1, nullptr); 140 ASSERT_NE(image1, nullptr);
141 SkImage* image2 = newImageResource->image()->imageForCurrentFrame().get( ); 141 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g et();
142 ASSERT_NE(image2, nullptr); 142 ASSERT_NE(image2, nullptr);
143 ASSERT_NE(image1, image2); 143 ASSERT_NE(image1, image2);
144 } 144 }
145 } 145 }
146 146
147 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698