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 5340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5351 host_impl_->ProcessScrollDeltas(); | 5351 host_impl_->ProcessScrollDeltas(); |
5352 | 5352 |
5353 // The root should have scrolled. | 5353 // The root should have scrolled. |
5354 ASSERT_EQ(2u, scroll_info->scrolls.size()); | 5354 ASSERT_EQ(2u, scroll_info->scrolls.size()); |
5355 ExpectContains(*scroll_info.get(), | 5355 ExpectContains(*scroll_info.get(), |
5356 host_impl_->active_tree()->root_layer()->id(), | 5356 host_impl_->active_tree()->root_layer()->id(), |
5357 gfx::Vector2d(0, 10)); | 5357 gfx::Vector2d(0, 10)); |
5358 } | 5358 } |
5359 } | 5359 } |
5360 | 5360 |
| 5361 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed |
| 5362 // to CompositorFrameMetadata after SwapBuffers(); |
| 5363 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { |
| 5364 scoped_ptr<SolidColorLayerImpl> root = |
| 5365 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
| 5366 root->SetAnchorPoint(gfx::PointF()); |
| 5367 root->SetPosition(gfx::PointF()); |
| 5368 root->SetBounds(gfx::Size(10, 10)); |
| 5369 root->SetContentBounds(gfx::Size(10, 10)); |
| 5370 root->SetDrawsContent(true); |
| 5371 |
| 5372 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
| 5373 |
| 5374 FakeOutputSurface* fake_output_surface = |
| 5375 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
| 5376 |
| 5377 const ui::LatencyInfo& metadata_latency_before = |
| 5378 fake_output_surface->last_sent_frame().metadata.latency_info; |
| 5379 EXPECT_FALSE(metadata_latency_before.FindLatency( |
| 5380 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
| 5381 |
| 5382 ui::LatencyInfo latency_info; |
| 5383 latency_info.AddLatencyNumber( |
| 5384 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0); |
| 5385 host_impl_->SetLatencyInfoForInputEvent(latency_info); |
| 5386 |
| 5387 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
| 5388 LayerTreeHostImpl::FrameData frame; |
| 5389 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
| 5390 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 5391 host_impl_->DidDrawAllLayers(frame); |
| 5392 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); |
| 5393 |
| 5394 const ui::LatencyInfo& metadata_latency_after = |
| 5395 fake_output_surface->last_sent_frame().metadata.latency_info; |
| 5396 EXPECT_TRUE(metadata_latency_after.FindLatency( |
| 5397 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
| 5398 } |
| 5399 |
5361 } // namespace | 5400 } // namespace |
5362 } // namespace cc | 5401 } // namespace cc |
OLD | NEW |