| 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_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Tests should set these to NULL if they've already triggered their | 116 // Tests should set these to NULL if they've already triggered their |
| 117 // destruction. | 117 // destruction. |
| 118 RenderWidgetHostImpl* widget_host_; | 118 RenderWidgetHostImpl* widget_host_; |
| 119 RenderWidgetHostViewChildFrame* view_; | 119 RenderWidgetHostViewChildFrame* view_; |
| 120 MockCrossProcessFrameConnector* test_frame_connector_; | 120 MockCrossProcessFrameConnector* test_frame_connector_; |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrameTest); | 123 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrameTest); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 std::unique_ptr<cc::CompositorFrame> CreateDelegatedFrame( | 126 cc::CompositorFrame CreateDelegatedFrame(float scale_factor, |
| 127 float scale_factor, | 127 gfx::Size size, |
| 128 gfx::Size size, | 128 const gfx::Rect& damage) { |
| 129 const gfx::Rect& damage) { | 129 cc::CompositorFrame frame; |
| 130 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 130 frame.metadata.device_scale_factor = scale_factor; |
| 131 frame->metadata.device_scale_factor = scale_factor; | 131 frame.delegated_frame_data.reset(new cc::DelegatedFrameData); |
| 132 frame->delegated_frame_data.reset(new cc::DelegatedFrameData); | |
| 133 | 132 |
| 134 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 133 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
| 135 pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, | 134 pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, |
| 136 gfx::Transform()); | 135 gfx::Transform()); |
| 137 frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); | 136 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
| 138 return frame; | 137 return frame; |
| 139 } | 138 } |
| 140 | 139 |
| 141 TEST_F(RenderWidgetHostViewChildFrameTest, VisibilityTest) { | 140 TEST_F(RenderWidgetHostViewChildFrameTest, VisibilityTest) { |
| 142 view_->Show(); | 141 view_->Show(); |
| 143 ASSERT_TRUE(view_->IsShowing()); | 142 ASSERT_TRUE(view_->IsShowing()); |
| 144 | 143 |
| 145 view_->Hide(); | 144 view_->Hide(); |
| 146 ASSERT_FALSE(view_->IsShowing()); | 145 ASSERT_FALSE(view_->IsShowing()); |
| 147 } | 146 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 172 | 171 |
| 173 // Surface ID should have been passed to CrossProcessFrameConnector to | 172 // Surface ID should have been passed to CrossProcessFrameConnector to |
| 174 // be sent to the embedding renderer. | 173 // be sent to the embedding renderer. |
| 175 EXPECT_EQ(id, test_frame_connector_->last_surface_id_received_); | 174 EXPECT_EQ(id, test_frame_connector_->last_surface_id_received_); |
| 176 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_); | 175 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_); |
| 177 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_); | 176 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_); |
| 178 } | 177 } |
| 179 } | 178 } |
| 180 | 179 |
| 181 } // namespace content | 180 } // namespace content |
| OLD | NEW |