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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 500 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
501 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), | 501 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), |
502 InputHandler::Wheel)); | 502 InputHandler::Wheel)); |
503 host_impl_->ScrollEnd(); | 503 host_impl_->ScrollEnd(); |
504 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), | 504 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), |
505 InputHandler::Wheel)); | 505 InputHandler::Wheel)); |
506 EXPECT_TRUE(did_request_redraw_); | 506 EXPECT_TRUE(did_request_redraw_); |
507 EXPECT_TRUE(did_request_commit_); | 507 EXPECT_TRUE(did_request_commit_); |
508 } | 508 } |
509 | 509 |
| 510 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) { |
| 511 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 512 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 513 DrawFrame(); |
| 514 |
| 515 EXPECT_EQ(InputHandler::ScrollStarted, |
| 516 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
| 517 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); |
| 518 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
| 519 EXPECT_TRUE(host_impl_->IsActivelyScrolling()); |
| 520 host_impl_->ScrollEnd(); |
| 521 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); |
| 522 } |
| 523 |
510 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { | 524 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { |
511 // We should not crash when trying to scroll an empty layer tree. | 525 // We should not crash when trying to scroll an empty layer tree. |
512 EXPECT_EQ(InputHandler::ScrollIgnored, | 526 EXPECT_EQ(InputHandler::ScrollIgnored, |
513 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | 527 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
514 } | 528 } |
515 | 529 |
516 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { | 530 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { |
517 scoped_ptr<TestWebGraphicsContext3D> context_owned = | 531 scoped_ptr<TestWebGraphicsContext3D> context_owned = |
518 TestWebGraphicsContext3D::Create(); | 532 TestWebGraphicsContext3D::Create(); |
519 context_owned->set_context_lost(true); | 533 context_owned->set_context_lost(true); |
(...skipping 6991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7511 // surface. | 7525 // surface. |
7512 EXPECT_EQ(0, num_lost_surfaces_); | 7526 EXPECT_EQ(0, num_lost_surfaces_); |
7513 host_impl_->DidLoseOutputSurface(); | 7527 host_impl_->DidLoseOutputSurface(); |
7514 EXPECT_EQ(1, num_lost_surfaces_); | 7528 EXPECT_EQ(1, num_lost_surfaces_); |
7515 host_impl_->DidLoseOutputSurface(); | 7529 host_impl_->DidLoseOutputSurface(); |
7516 EXPECT_LE(1, num_lost_surfaces_); | 7530 EXPECT_LE(1, num_lost_surfaces_); |
7517 } | 7531 } |
7518 | 7532 |
7519 } // namespace | 7533 } // namespace |
7520 } // namespace cc | 7534 } // namespace cc |
OLD | NEW |