Chromium Code Reviews| 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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); | 1391 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); |
| 1392 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); | 1392 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
| 1393 host_impl_->ScrollEnd(); | 1393 host_impl_->ScrollEnd(); |
| 1394 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1394 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); |
| 1395 } | 1395 } |
| 1396 | 1396 |
| 1397 TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) { | 1397 TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) { |
| 1398 LayerTreeSettings settings; | 1398 LayerTreeSettings settings; |
| 1399 settings.scrollbar_animator = LayerTreeSettings::LinearFade; | 1399 settings.scrollbar_animator = LayerTreeSettings::LinearFade; |
| 1400 settings.scrollbar_fade_delay_ms = 20; | 1400 settings.scrollbar_fade_delay_ms = 20; |
| 1401 settings.scrollbar_fade_resize_delay_ms = 50; | |
| 1401 settings.scrollbar_fade_duration_ms = 20; | 1402 settings.scrollbar_fade_duration_ms = 20; |
| 1402 settings.use_pinch_zoom_scrollbars = true; | 1403 settings.use_pinch_zoom_scrollbars = true; |
| 1403 | 1404 |
| 1404 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); | 1405 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); |
| 1405 | 1406 |
| 1406 base::TimeTicks fake_now = gfx::FrameTime::Now(); | 1407 base::TimeTicks fake_now = gfx::FrameTime::Now(); |
| 1407 | 1408 |
| 1408 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 1409 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 1409 | 1410 |
| 1410 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1411 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1427 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1428 requested_scrollbar_animation_delay_ = base::TimeDelta(); |
| 1428 | 1429 |
| 1429 // We should not see any draw requests. | 1430 // We should not see any draw requests. |
| 1430 fake_now += base::TimeDelta::FromMilliseconds(25); | 1431 fake_now += base::TimeDelta::FromMilliseconds(25); |
| 1431 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1432 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); |
| 1432 EXPECT_FALSE(did_request_animate_); | 1433 EXPECT_FALSE(did_request_animate_); |
| 1433 | 1434 |
| 1434 // Make page scale > min so that subsequent scrolls will trigger fades. | 1435 // Make page scale > min so that subsequent scrolls will trigger fades. |
| 1435 host_impl_->active_tree()->SetPageScaleDelta(1.1f); | 1436 host_impl_->active_tree()->SetPageScaleDelta(1.1f); |
| 1436 | 1437 |
| 1437 // After a scroll, a fade animation should be scheduled about 20ms from now. | 1438 // After a scroll, a fade animation should be scheduled about 50ms from now. |
|
aelias_OOO_until_Jul13
2014/10/01 18:41:26
"After pinch causes a scrollbar resize,"
MuVen
2014/10/02 08:42:47
Done.
| |
| 1438 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); | 1439 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel); |
| 1439 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); | 1440 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
| 1440 host_impl_->ScrollEnd(); | 1441 host_impl_->ScrollEnd(); |
| 1441 did_request_redraw_ = false; | 1442 did_request_redraw_ = false; |
| 1442 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), | 1443 EXPECT_LT(base::TimeDelta::FromMilliseconds(49), |
| 1443 requested_scrollbar_animation_delay_); | 1444 requested_scrollbar_animation_delay_); |
| 1444 EXPECT_FALSE(did_request_animate_); | 1445 EXPECT_FALSE(did_request_animate_); |
| 1445 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1446 requested_scrollbar_animation_delay_ = base::TimeDelta(); |
| 1446 scrollbar_fade_start_.Run(); | 1447 scrollbar_fade_start_.Run(); |
| 1447 | 1448 |
| 1448 // After the fade begins, we should start getting redraws instead of a | 1449 // After the fade begins, we should start getting redraws instead of a |
| 1449 // scheduled animation. | 1450 // scheduled animation. |
| 1450 fake_now += base::TimeDelta::FromMilliseconds(25); | 1451 fake_now += base::TimeDelta::FromMilliseconds(25); |
| 1451 host_impl_->Animate(fake_now); | 1452 host_impl_->Animate(fake_now); |
| 1452 EXPECT_TRUE(did_request_animate_); | 1453 EXPECT_TRUE(did_request_animate_); |
| (...skipping 5718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7171 // surface. | 7172 // surface. |
| 7172 EXPECT_EQ(0, num_lost_surfaces_); | 7173 EXPECT_EQ(0, num_lost_surfaces_); |
| 7173 host_impl_->DidLoseOutputSurface(); | 7174 host_impl_->DidLoseOutputSurface(); |
| 7174 EXPECT_EQ(1, num_lost_surfaces_); | 7175 EXPECT_EQ(1, num_lost_surfaces_); |
| 7175 host_impl_->DidLoseOutputSurface(); | 7176 host_impl_->DidLoseOutputSurface(); |
| 7176 EXPECT_LE(1, num_lost_surfaces_); | 7177 EXPECT_LE(1, num_lost_surfaces_); |
| 7177 } | 7178 } |
| 7178 | 7179 |
| 7179 } // namespace | 7180 } // namespace |
| 7180 } // namespace cc | 7181 } // namespace cc |
| OLD | NEW |