| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 private: | 210 private: |
| 211 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestSurfaceTest); | 211 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestSurfaceTest); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 namespace { | 214 namespace { |
| 215 cc::CompositorFrame CreateDelegatedFrame(float scale_factor, | 215 cc::CompositorFrame CreateDelegatedFrame(float scale_factor, |
| 216 gfx::Size size, | 216 gfx::Size size, |
| 217 const gfx::Rect& damage) { | 217 const gfx::Rect& damage) { |
| 218 cc::CompositorFrame frame; | 218 cc::CompositorFrame frame; |
| 219 frame.metadata.device_scale_factor = scale_factor; | 219 frame.metadata.device_scale_factor = scale_factor; |
| 220 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, 0, true); | 220 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); |
| 221 | 221 |
| 222 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 222 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
| 223 pass->SetNew(1, gfx::Rect(size), damage, gfx::Transform()); | 223 pass->SetNew(1, gfx::Rect(size), damage, gfx::Transform()); |
| 224 frame.render_pass_list.push_back(std::move(pass)); | 224 frame.render_pass_list.push_back(std::move(pass)); |
| 225 return frame; | 225 return frame; |
| 226 } | 226 } |
| 227 } // anonymous namespace | 227 } // anonymous namespace |
| 228 | 228 |
| 229 TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) { | 229 TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) { |
| 230 gfx::Size view_size(100, 100); | 230 gfx::Size view_size(100, 100); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 view_->OnSwapCompositorFrame( | 289 view_->OnSwapCompositorFrame( |
| 290 0, local_surface_id, | 290 0, local_surface_id, |
| 291 CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 291 CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 292 // Since guest is not attached, the CompositorFrame must be processed but the | 292 // Since guest is not attached, the CompositorFrame must be processed but the |
| 293 // frame must be evicted to return the resources immediately. | 293 // frame must be evicted to return the resources immediately. |
| 294 EXPECT_FALSE(view_->has_frame()); | 294 EXPECT_FALSE(view_->has_frame()); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace content | 297 } // namespace content |
| OLD | NEW |