| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/renderer/pepper/gfx_conversion.h" | 9 #include "content/renderer/pepper/gfx_conversion.h" |
| 10 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" | 10 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class PepperGraphics2DHostTest : public testing::Test { | 26 class PepperGraphics2DHostTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 static bool ConvertToLogicalPixels(float scale, | 28 static bool ConvertToLogicalPixels(float scale, |
| 29 gfx::Rect* op_rect, | 29 gfx::Rect* op_rect, |
| 30 gfx::Point* delta) { | 30 gfx::Point* delta) { |
| 31 return PepperGraphics2DHost::ConvertToLogicalPixels(scale, op_rect, delta); | 31 return PepperGraphics2DHost::ConvertToLogicalPixels(scale, op_rect, delta); |
| 32 } | 32 } |
| 33 | 33 |
| 34 PepperGraphics2DHostTest() : renderer_ppapi_host_(NULL, 12345) {} | 34 PepperGraphics2DHostTest() : renderer_ppapi_host_(NULL, 12345) {} |
| 35 | 35 |
| 36 virtual ~PepperGraphics2DHostTest() { | 36 ~PepperGraphics2DHostTest() override { |
| 37 ppapi::ProxyAutoLock proxy_lock; | 37 ppapi::ProxyAutoLock proxy_lock; |
| 38 host_.reset(); | 38 host_.reset(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void Init(PP_Instance instance, | 41 void Init(PP_Instance instance, |
| 42 const PP_Size& backing_store_size, | 42 const PP_Size& backing_store_size, |
| 43 const PP_Rect& plugin_rect) { | 43 const PP_Rect& plugin_rect) { |
| 44 renderer_view_data_.rect = plugin_rect; | 44 renderer_view_data_.rect = plugin_rect; |
| 45 test_globals_.GetResourceTracker()->DidCreateInstance(instance); | 45 test_globals_.GetResourceTracker()->DidCreateInstance(instance); |
| 46 scoped_refptr<PPB_ImageData_Impl> backing_store( | 46 scoped_refptr<PPB_ImageData_Impl> backing_store( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2)); | 159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2)); |
| 160 } | 160 } |
| 161 // Reverse the scale and ensure all the original pixels are still inside | 161 // Reverse the scale and ensure all the original pixels are still inside |
| 162 // the result. | 162 // the result. |
| 163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL); | 163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL); |
| 164 EXPECT_TRUE(r1.Contains(orig)); | 164 EXPECT_TRUE(r1.Contains(orig)); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace content |
| OLD | NEW |