| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHost); | 226 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHost); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 namespace { | 229 namespace { |
| 230 | 230 |
| 231 cc::CompositorFrame MakeCompositorFrame(float scale_factor, gfx::Size size) { | 231 cc::CompositorFrame MakeCompositorFrame(float scale_factor, gfx::Size size) { |
| 232 cc::CompositorFrame frame; | 232 cc::CompositorFrame frame; |
| 233 frame.metadata.device_scale_factor = scale_factor; | 233 frame.metadata.device_scale_factor = scale_factor; |
| 234 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, 0, true); | 234 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); |
| 235 | 235 |
| 236 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 236 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
| 237 pass->SetNew(1, gfx::Rect(size), gfx::Rect(), gfx::Transform()); | 237 pass->SetNew(1, gfx::Rect(size), gfx::Rect(), gfx::Transform()); |
| 238 frame.render_pass_list.push_back(std::move(pass)); | 238 frame.render_pass_list.push_back(std::move(pass)); |
| 239 if (!size.IsEmpty()) { | 239 if (!size.IsEmpty()) { |
| 240 cc::TransferableResource resource; | 240 cc::TransferableResource resource; |
| 241 resource.id = 1; | 241 resource.id = 1; |
| 242 frame.resource_list.push_back(std::move(resource)); | 242 frame.resource_list.push_back(std::move(resource)); |
| 243 } | 243 } |
| 244 return frame; | 244 return frame; |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 const cc::LocalSurfaceId local_surface_id(1, | 1329 const cc::LocalSurfaceId local_surface_id(1, |
| 1330 base::UnguessableToken::Create()); | 1330 base::UnguessableToken::Create()); |
| 1331 | 1331 |
| 1332 host_->StartNewContentRenderingTimeout(100); | 1332 host_->StartNewContentRenderingTimeout(100); |
| 1333 host_->set_new_content_rendering_delay_for_testing( | 1333 host_->set_new_content_rendering_delay_for_testing( |
| 1334 base::TimeDelta::FromMicroseconds(9999)); | 1334 base::TimeDelta::FromMicroseconds(9999)); |
| 1335 | 1335 |
| 1336 { | 1336 { |
| 1337 // First swap a frame with an invalid ID. | 1337 // First swap a frame with an invalid ID. |
| 1338 cc::CompositorFrame frame = MakeCompositorFrame(1.f, frame_size); | 1338 cc::CompositorFrame frame = MakeCompositorFrame(1.f, frame_size); |
| 1339 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, 0, true); | 1339 frame.metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); |
| 1340 frame.metadata.content_source_id = 99; | 1340 frame.metadata.content_source_id = 99; |
| 1341 host_->OnMessageReceived(ViewHostMsg_SwapCompositorFrame( | 1341 host_->OnMessageReceived(ViewHostMsg_SwapCompositorFrame( |
| 1342 0, 0, local_surface_id, frame, std::vector<IPC::Message>())); | 1342 0, 0, local_surface_id, frame, std::vector<IPC::Message>())); |
| 1343 EXPECT_FALSE( | 1343 EXPECT_FALSE( |
| 1344 static_cast<TestView*>(host_->GetView())->did_swap_compositor_frame()); | 1344 static_cast<TestView*>(host_->GetView())->did_swap_compositor_frame()); |
| 1345 static_cast<TestView*>(host_->GetView())->reset_did_swap_compositor_frame(); | 1345 static_cast<TestView*>(host_->GetView())->reset_did_swap_compositor_frame(); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 { | 1348 { |
| 1349 // Test with a valid content ID as a control. | 1349 // Test with a valid content ID as a control. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 ui::LatencyInfo()); | 1861 ui::LatencyInfo()); |
| 1862 | 1862 |
| 1863 | 1863 |
| 1864 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). | 1864 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). |
| 1865 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); | 1865 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); |
| 1866 | 1866 |
| 1867 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1867 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 } // namespace content | 1870 } // namespace content |
| OLD | NEW |