OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/top_controls_manager.h" | 5 #include "cc/input/top_controls_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 EXPECT_FLOAT_EQ(0.f, manager->BottomControlsShownRatio()); | 505 EXPECT_FLOAT_EQ(0.f, manager->BottomControlsShownRatio()); |
506 manager->ScrollEnd(); | 506 manager->ScrollEnd(); |
507 | 507 |
508 manager->ScrollBegin(); | 508 manager->ScrollBegin(); |
509 manager->ScrollBy(gfx::Vector2dF(0.f, -15.f)); | 509 manager->ScrollBy(gfx::Vector2dF(0.f, -15.f)); |
510 EXPECT_FLOAT_EQ(15.f, manager->ContentBottomOffset()); | 510 EXPECT_FLOAT_EQ(15.f, manager->ContentBottomOffset()); |
511 EXPECT_FLOAT_EQ(0.15f, manager->BottomControlsShownRatio()); | 511 EXPECT_FLOAT_EQ(0.15f, manager->BottomControlsShownRatio()); |
512 manager->ScrollEnd(); | 512 manager->ScrollEnd(); |
513 } | 513 } |
514 | 514 |
| 515 TEST(TopControlsManagerTest, HideAndImmediateShowKeepsControlsVisible) { |
| 516 MockTopControlsManagerClient client(100.f, 0.5f, 0.5f); |
| 517 client.SetBottomControlsHeight(100.f); |
| 518 TopControlsManager* manager = client.manager(); |
| 519 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); |
| 520 |
| 521 manager->UpdateTopControlsState(BOTH, HIDDEN, true); |
| 522 EXPECT_TRUE(manager->has_animation()); |
| 523 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); |
| 524 |
| 525 manager->UpdateTopControlsState(BOTH, SHOWN, true); |
| 526 EXPECT_FALSE(manager->has_animation()); |
| 527 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); |
| 528 } |
| 529 |
515 } // namespace | 530 } // namespace |
516 } // namespace cc | 531 } // namespace cc |
OLD | NEW |