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/scrollbar_animation_controller_thinning.h" | 5 #include "cc/input/scrollbar_animation_controller_thinning.h" |
6 | 6 |
7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
8 #include "cc/test/fake_impl_task_runner_provider.h" | 8 #include "cc/test/fake_impl_task_runner_provider.h" |
9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
10 #include "cc/test/geometry_test_utils.h" | 10 #include "cc/test/geometry_test_utils.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // stay thick and dark | 511 // stay thick and dark |
512 // test for 10 seconds, stay thick and dark | 512 // test for 10 seconds, stay thick and dark |
513 for (int i = 0; i < 10; ++i) { | 513 for (int i = 0; i < 10; ++i) { |
514 time += base::TimeDelta::FromSeconds(1); | 514 time += base::TimeDelta::FromSeconds(1); |
515 scrollbar_controller_->Animate(time); | 515 scrollbar_controller_->Animate(time); |
516 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); | 516 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); |
517 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); | 517 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
| 521 // Move mouse on scrollbar and capture then move out of window. Confirm that |
| 522 // the bar stays thick and dark. |
| 523 TEST_F(ScrollbarAnimationControllerThinningTest, |
| 524 MouseCapturedAndExitWindowFromScrollbar) { |
| 525 base::TimeTicks time; |
| 526 time += base::TimeDelta::FromSeconds(1); |
| 527 |
| 528 // Move in |
| 529 scrollbar_controller_->DidMouseMoveNear(0); |
| 530 |
| 531 scrollbar_controller_->Animate(time); |
| 532 time += base::TimeDelta::FromSeconds(kDuration); |
| 533 scrollbar_controller_->Animate(time); |
| 534 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); |
| 535 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
| 536 |
| 537 // Capture |
| 538 scrollbar_controller_->DidCaptureScrollbarBegin(); |
| 539 time += base::TimeDelta::FromSeconds(1); |
| 540 scrollbar_controller_->Animate(time); |
| 541 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); |
| 542 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
| 543 |
| 544 // move out of window |
| 545 scrollbar_controller_->DidMouseMoveOffScrollbar(); |
| 546 |
| 547 // test for 10 seconds, stay thick and dark |
| 548 for (int i = 0; i < 10; ++i) { |
| 549 time += base::TimeDelta::FromSeconds(1); |
| 550 scrollbar_controller_->Animate(time); |
| 551 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity()); |
| 552 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); |
| 553 } |
| 554 } |
| 555 |
521 } // namespace | 556 } // namespace |
522 } // namespace cc | 557 } // namespace cc |
OLD | NEW |