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

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc

Issue 11146009: Mac Flash: Fix scaling bitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc
index e92720de97c01906f8b1b45abe5ecb976b66ec3c..c885378ee61c5dbe6ed57e4eb9e8b06a9e51c6ec 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl_unittest.cc
@@ -6,9 +6,17 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/safe_integer_conversions.h"
+#include "webkit/plugins/ppapi/ppapi_unittest.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
-TEST(PpapiGraphics2DImplTest, ConvertToLogicalPixels) {
+namespace webkit {
+namespace ppapi {
+
+typedef PpapiUnittest PpapiGraphics2DImplTest;
+
+TEST_F(PpapiGraphics2DImplTest, ConvertToLogicalPixels) {
static const struct {
int x1;
int y1;
@@ -78,3 +86,39 @@ TEST(PpapiGraphics2DImplTest, ConvertToLogicalPixels) {
EXPECT_TRUE(r1.Contains(orig));
}
}
+
+// Test that GetBitmapForOptimizedPluginPaint doesn't return a bitmap rect
+// that's bigger than the actual backing store bitmap.
+TEST_F(PpapiGraphics2DImplTest, GetBitmap2xScale) {
+ PP_Size size;
+ size.width = 3;
+ size.height = 3;
+ PP_Resource resource =
+ PPB_Graphics2D_Impl::Create(instance()->pp_instance(), size, PP_TRUE);
+ EXPECT_TRUE(resource);
+ EXPECT_TRUE(instance()->BindGraphics(instance()->pp_instance(), resource));
+ instance()->set_always_on_top(true);
+ float scale = 2.0;
+ SetViewSize(size.width, size.height, 1.0 / scale);
+
+ gfx::Rect bounds(0, 0, 1, 1);
+ gfx::Rect location;
+ gfx::Rect clip;
+ float bitmap_scale = 0;
+ TransportDIB* dib = NULL;
+ EXPECT_TRUE(instance()->GetBitmapForOptimizedPluginPaint(
+ bounds, &dib, &location, &clip, &bitmap_scale));
+
+ EXPECT_EQ(0, location.x());
+ EXPECT_EQ(0, location.y());
+ EXPECT_EQ(gfx::ToFlooredInt(size.width / scale), location.width());
+ EXPECT_EQ(gfx::ToFlooredInt(size.height / scale), location.height());
+ EXPECT_EQ(0, clip.x());
+ EXPECT_EQ(0, clip.y());
+ EXPECT_EQ(size.width, clip.width());
+ EXPECT_EQ(size.height, clip.height());
+ EXPECT_EQ(scale, bitmap_scale);
+}
+
+} // namespace ppapi
+} // namespace webkit
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698