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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 | 1137 |
1138 base::TimeTicks fake_now = base::TimeTicks::Now(); | 1138 base::TimeTicks fake_now = base::TimeTicks::Now(); |
1139 host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now); | 1139 host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now); |
1140 | 1140 |
1141 // If no scroll happened recently, StartScrollbarAnimation should have no | 1141 // If no scroll happened recently, StartScrollbarAnimation should have no |
1142 // effect. | 1142 // effect. |
1143 host_impl_->StartScrollbarAnimation(); | 1143 host_impl_->StartScrollbarAnimation(); |
1144 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1144 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); |
1145 EXPECT_FALSE(did_request_redraw_); | 1145 EXPECT_FALSE(did_request_redraw_); |
1146 | 1146 |
| 1147 // If no scroll happened during a scroll gesture, StartScrollbarAnimation |
| 1148 // should have no effect. |
| 1149 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); |
| 1150 host_impl_->ScrollEnd(); |
| 1151 host_impl_->StartScrollbarAnimation(); |
| 1152 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); |
| 1153 EXPECT_FALSE(did_request_redraw_); |
| 1154 |
1147 // After a scroll, a fade animation should be scheduled about 20ms from now. | 1155 // After a scroll, a fade animation should be scheduled about 20ms from now. |
1148 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); | 1156 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); |
| 1157 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
1149 host_impl_->ScrollEnd(); | 1158 host_impl_->ScrollEnd(); |
| 1159 did_request_redraw_ = false; |
1150 host_impl_->StartScrollbarAnimation(); | 1160 host_impl_->StartScrollbarAnimation(); |
1151 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), | 1161 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), |
1152 requested_scrollbar_animation_delay_); | 1162 requested_scrollbar_animation_delay_); |
1153 EXPECT_FALSE(did_request_redraw_); | 1163 EXPECT_FALSE(did_request_redraw_); |
1154 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1164 requested_scrollbar_animation_delay_ = base::TimeDelta(); |
1155 | 1165 |
1156 // After the fade begins, we should start getting redraws instead of a | 1166 // After the fade begins, we should start getting redraws instead of a |
1157 // scheduled animation. | 1167 // scheduled animation. |
1158 fake_now += base::TimeDelta::FromMilliseconds(25); | 1168 fake_now += base::TimeDelta::FromMilliseconds(25); |
1159 host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now); | 1169 host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now); |
(...skipping 5339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6499 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6509 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6500 EXPECT_EQ(0u, context3d->NumTextures()); | 6510 EXPECT_EQ(0u, context3d->NumTextures()); |
6501 | 6511 |
6502 // Should not change state for multiple deletion on one UIResourceId | 6512 // Should not change state for multiple deletion on one UIResourceId |
6503 host_impl_->DeleteUIResource(ui_resource_id); | 6513 host_impl_->DeleteUIResource(ui_resource_id); |
6504 EXPECT_EQ(0u, context3d->NumTextures()); | 6514 EXPECT_EQ(0u, context3d->NumTextures()); |
6505 } | 6515 } |
6506 | 6516 |
6507 } // namespace | 6517 } // namespace |
6508 } // namespace cc | 6518 } // namespace cc |
OLD | NEW |