| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/frame_host/render_widget_host_view_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Tests should set these to NULL if they've already triggered their | 203 // Tests should set these to NULL if they've already triggered their |
| 204 // destruction. | 204 // destruction. |
| 205 RenderWidgetHostImpl* widget_host_; | 205 RenderWidgetHostImpl* widget_host_; |
| 206 RenderWidgetHostViewGuest* view_; | 206 RenderWidgetHostViewGuest* view_; |
| 207 | 207 |
| 208 private: | 208 private: |
| 209 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestSurfaceTest); | 209 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestSurfaceTest); |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 namespace { | 212 namespace { |
| 213 std::unique_ptr<cc::CompositorFrame> CreateDelegatedFrame( | 213 cc::CompositorFrame CreateDelegatedFrame(float scale_factor, |
| 214 float scale_factor, | 214 gfx::Size size, |
| 215 gfx::Size size, | 215 const gfx::Rect& damage) { |
| 216 const gfx::Rect& damage) { | 216 cc::CompositorFrame frame; |
| 217 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 217 frame.metadata.device_scale_factor = scale_factor; |
| 218 frame->metadata.device_scale_factor = scale_factor; | 218 frame.delegated_frame_data.reset(new cc::DelegatedFrameData); |
| 219 frame->delegated_frame_data.reset(new cc::DelegatedFrameData); | |
| 220 | 219 |
| 221 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 220 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
| 222 pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, | 221 pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, |
| 223 gfx::Transform()); | 222 gfx::Transform()); |
| 224 frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); | 223 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
| 225 return frame; | 224 return frame; |
| 226 } | 225 } |
| 227 } // anonymous namespace | 226 } // anonymous namespace |
| 228 | 227 |
| 229 TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) { | 228 TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) { |
| 230 gfx::Size view_size(100, 100); | 229 gfx::Size view_size(100, 100); |
| 231 gfx::Rect view_rect(view_size); | 230 gfx::Rect view_rect(view_size); |
| 232 float scale_factor = 1.f; | 231 float scale_factor = 1.f; |
| 233 | 232 |
| 234 ASSERT_TRUE(browser_plugin_guest_); | 233 ASSERT_TRUE(browser_plugin_guest_); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 282 |
| 284 browser_plugin_guest_->set_attached(false); | 283 browser_plugin_guest_->set_attached(false); |
| 285 browser_plugin_guest_->ResetTestData(); | 284 browser_plugin_guest_->ResetTestData(); |
| 286 | 285 |
| 287 view_->OnSwapCompositorFrame( | 286 view_->OnSwapCompositorFrame( |
| 288 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 287 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 289 EXPECT_TRUE(surface_id().is_null()); | 288 EXPECT_TRUE(surface_id().is_null()); |
| 290 } | 289 } |
| 291 | 290 |
| 292 } // namespace content | 291 } // namespace content |
| OLD | NEW |