OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 5317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5328 host_impl_->ProcessScrollDeltas(); | 5328 host_impl_->ProcessScrollDeltas(); |
5329 | 5329 |
5330 // The root should have scrolled. | 5330 // The root should have scrolled. |
5331 ASSERT_EQ(2u, scroll_info->scrolls.size()); | 5331 ASSERT_EQ(2u, scroll_info->scrolls.size()); |
5332 ExpectContains(*scroll_info.get(), | 5332 ExpectContains(*scroll_info.get(), |
5333 host_impl_->active_tree()->root_layer()->id(), | 5333 host_impl_->active_tree()->root_layer()->id(), |
5334 gfx::Vector2d(0, 10)); | 5334 gfx::Vector2d(0, 10)); |
5335 } | 5335 } |
5336 } | 5336 } |
5337 | 5337 |
| 5338 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed |
| 5339 // to CompositorFrameMetadata after SwapBuffers(); |
| 5340 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { |
| 5341 scoped_ptr<SolidColorLayerImpl> root = |
| 5342 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
| 5343 root->SetAnchorPoint(gfx::PointF()); |
| 5344 root->SetPosition(gfx::PointF()); |
| 5345 root->SetBounds(gfx::Size(10, 10)); |
| 5346 root->SetContentBounds(gfx::Size(10, 10)); |
| 5347 root->SetDrawsContent(true); |
| 5348 |
| 5349 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
| 5350 |
| 5351 FakeOutputSurface* fake_output_surface = |
| 5352 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
| 5353 |
| 5354 const ui::LatencyInfo& metadata_latency_before = |
| 5355 fake_output_surface->last_sent_frame().metadata.latency_info; |
| 5356 EXPECT_FALSE(metadata_latency_before.FindLatency( |
| 5357 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
| 5358 |
| 5359 ui::LatencyInfo latency_info; |
| 5360 latency_info.AddLatencyNumber( |
| 5361 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0); |
| 5362 host_impl_->SetLatencyInfoForInputEvent(latency_info); |
| 5363 |
| 5364 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
| 5365 LayerTreeHostImpl::FrameData frame; |
| 5366 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
| 5367 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5368 host_impl_->DidDrawAllLayers(frame); |
| 5369 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); |
| 5370 |
| 5371 const ui::LatencyInfo& metadata_latency_after = |
| 5372 fake_output_surface->last_sent_frame().metadata.latency_info; |
| 5373 EXPECT_TRUE(metadata_latency_after.FindLatency( |
| 5374 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
| 5375 } |
| 5376 |
5338 } // namespace | 5377 } // namespace |
5339 } // namespace cc | 5378 } // namespace cc |
OLD | NEW |