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

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

Issue 2738573002: Streamline the presentation of ImageBitmapRenderingContext (Closed)
Patch Set: Fixed expectations Created 3 years, 8 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ImageBitmap* imageBitmapOutsideCrop = ImageBitmap::create( 127 ImageBitmap* imageBitmapOutsideCrop = ImageBitmap::create(
128 imageElement, cropRect, &(imageElement->document()), defaultOptions); 128 imageElement, cropRect, &(imageElement->document()), defaultOptions);
129 129
130 ASSERT_NE(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(), 130 ASSERT_NE(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(),
131 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); 131 imageElement->cachedImage()->getImage()->imageForCurrentFrame());
132 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), 132 ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(),
133 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); 133 imageElement->cachedImage()->getImage()->imageForCurrentFrame());
134 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), 134 ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(),
135 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); 135 imageElement->cachedImage()->getImage()->imageForCurrentFrame());
136 136
137 StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage(); 137 RefPtr<StaticBitmapImage> emptyImage = imageBitmapOutsideCrop->bitmapImage();
138 ASSERT_NE(emptyImage->imageForCurrentFrame(), 138 ASSERT_NE(emptyImage->imageForCurrentFrame(),
139 imageElement->cachedImage()->getImage()->imageForCurrentFrame()); 139 imageElement->cachedImage()->getImage()->imageForCurrentFrame());
140 } 140 }
141 141
142 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a 142 // Verifies that ImageBitmaps constructed from HTMLImageElements hold a
143 // reference to the original Image if the HTMLImageElement src is changed. 143 // reference to the original Image if the HTMLImageElement src is changed.
144 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) { 144 TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) {
145 HTMLImageElement* image = HTMLImageElement::create(*Document::create()); 145 HTMLImageElement* image = HTMLImageElement::create(*Document::create());
146 ImageResourceContent* originalImageResource = 146 ImageResourceContent* originalImageResource =
147 ImageResourceContent::create(StaticBitmapImage::create(m_image).get()); 147 ImageResourceContent::create(StaticBitmapImage::create(m_image).get());
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32, 551 colorSpaceXform->apply(colorFormat, transformedPixel.get(), colorFormat32,
552 srcPixel.get(), 1, 552 srcPixel.get(), 1,
553 SkAlphaType::kUnpremul_SkAlphaType); 553 SkAlphaType::kUnpremul_SkAlphaType);
554 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(), 554 int compare = std::memcmp(convertedPixel.get(), transformedPixel.get(),
555 imageInfo.bytesPerPixel()); 555 imageInfo.bytesPerPixel());
556 ASSERT_EQ(compare, 0); 556 ASSERT_EQ(compare, 0);
557 } 557 }
558 } 558 }
559 559
560 } // namespace blink 560 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.h ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698