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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 505 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
506 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), | 506 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), |
507 InputHandler::Wheel)); | 507 InputHandler::Wheel)); |
508 host_impl_->ScrollEnd(); | 508 host_impl_->ScrollEnd(); |
509 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), | 509 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), |
510 InputHandler::Wheel)); | 510 InputHandler::Wheel)); |
511 EXPECT_TRUE(did_request_redraw_); | 511 EXPECT_TRUE(did_request_redraw_); |
512 EXPECT_TRUE(did_request_commit_); | 512 EXPECT_TRUE(did_request_commit_); |
513 } | 513 } |
514 | 514 |
515 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) { | |
516 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | |
517 host_impl_->SetViewportSize(gfx::Size(50, 50)); | |
518 DrawFrame(); | |
519 | |
520 EXPECT_EQ(InputHandler::ScrollStarted, | |
521 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | |
522 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); | |
brianderson
2014/10/23 22:39:42
Is this the expectation that would fail without yo
jdduke (slow)
2014/10/23 22:45:13
Yup, exactly.
| |
523 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | |
524 EXPECT_TRUE(host_impl_->IsActivelyScrolling()); | |
525 host_impl_->ScrollEnd(); | |
526 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); | |
527 } | |
528 | |
515 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { | 529 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { |
516 // We should not crash when trying to scroll an empty layer tree. | 530 // We should not crash when trying to scroll an empty layer tree. |
517 EXPECT_EQ(InputHandler::ScrollIgnored, | 531 EXPECT_EQ(InputHandler::ScrollIgnored, |
518 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | 532 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
519 } | 533 } |
520 | 534 |
521 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { | 535 TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) { |
522 scoped_ptr<TestWebGraphicsContext3D> context_owned = | 536 scoped_ptr<TestWebGraphicsContext3D> context_owned = |
523 TestWebGraphicsContext3D::Create(); | 537 TestWebGraphicsContext3D::Create(); |
524 context_owned->set_context_lost(true); | 538 context_owned->set_context_lost(true); |
(...skipping 7013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7538 // surface. | 7552 // surface. |
7539 EXPECT_EQ(0, num_lost_surfaces_); | 7553 EXPECT_EQ(0, num_lost_surfaces_); |
7540 host_impl_->DidLoseOutputSurface(); | 7554 host_impl_->DidLoseOutputSurface(); |
7541 EXPECT_EQ(1, num_lost_surfaces_); | 7555 EXPECT_EQ(1, num_lost_surfaces_); |
7542 host_impl_->DidLoseOutputSurface(); | 7556 host_impl_->DidLoseOutputSurface(); |
7543 EXPECT_LE(1, num_lost_surfaces_); | 7557 EXPECT_LE(1, num_lost_surfaces_); |
7544 } | 7558 } |
7545 | 7559 |
7546 } // namespace | 7560 } // namespace |
7547 } // namespace cc | 7561 } // namespace cc |
OLD | NEW |