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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 float min_page_scale = 0.5f; | 1282 float min_page_scale = 0.5f; |
1283 float max_page_scale = 4.f; | 1283 float max_page_scale = 4.f; |
1284 host_impl_->sync_tree()->SetPageScaleFactorAndLimits(1.f, | 1284 host_impl_->sync_tree()->SetPageScaleFactorAndLimits(1.f, |
1285 min_page_scale, | 1285 min_page_scale, |
1286 max_page_scale); | 1286 max_page_scale); |
1287 host_impl_->ActivateSyncTree(); | 1287 host_impl_->ActivateSyncTree(); |
1288 | 1288 |
1289 base::TimeTicks start_time = base::TimeTicks() + | 1289 base::TimeTicks start_time = base::TimeTicks() + |
1290 base::TimeDelta::FromSeconds(1); | 1290 base::TimeDelta::FromSeconds(1); |
1291 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); | 1291 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
| 1292 base::TimeTicks third_through_animation = start_time + duration / 3; |
1292 base::TimeTicks halfway_through_animation = start_time + duration / 2; | 1293 base::TimeTicks halfway_through_animation = start_time + duration / 2; |
1293 base::TimeTicks end_time = start_time + duration; | 1294 base::TimeTicks end_time = start_time + duration; |
1294 float target_scale = 2.f; | 1295 float target_scale = 2.f; |
1295 | 1296 |
1296 scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); | 1297 scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); |
1297 | 1298 |
1298 // Make sure TakePageScaleAnimation works properly. | 1299 // Make sure TakePageScaleAnimation works properly. |
1299 host_impl_->sync_tree()->SetPageScaleAnimation( | 1300 host_impl_->sync_tree()->SetPageScaleAnimation( |
1300 gfx::Vector2d(), | 1301 gfx::Vector2d(), |
1301 false, | 1302 false, |
(...skipping 27 matching lines...) Expand all Loading... |
1329 | 1330 |
1330 // From here on, make sure the animation runs as normal. | 1331 // From here on, make sure the animation runs as normal. |
1331 did_request_redraw_ = false; | 1332 did_request_redraw_ = false; |
1332 did_request_animate_ = false; | 1333 did_request_animate_ = false; |
1333 host_impl_->Animate(start_time); | 1334 host_impl_->Animate(start_time); |
1334 EXPECT_TRUE(did_request_redraw_); | 1335 EXPECT_TRUE(did_request_redraw_); |
1335 EXPECT_TRUE(did_request_animate_); | 1336 EXPECT_TRUE(did_request_animate_); |
1336 | 1337 |
1337 did_request_redraw_ = false; | 1338 did_request_redraw_ = false; |
1338 did_request_animate_ = false; | 1339 did_request_animate_ = false; |
| 1340 host_impl_->Animate(third_through_animation); |
| 1341 EXPECT_TRUE(did_request_redraw_); |
| 1342 EXPECT_TRUE(did_request_animate_); |
| 1343 |
| 1344 // Another activation shouldn't have any effect on the animation. |
| 1345 host_impl_->ActivateSyncTree(); |
| 1346 |
| 1347 did_request_redraw_ = false; |
| 1348 did_request_animate_ = false; |
1339 host_impl_->Animate(halfway_through_animation); | 1349 host_impl_->Animate(halfway_through_animation); |
1340 EXPECT_TRUE(did_request_redraw_); | 1350 EXPECT_TRUE(did_request_redraw_); |
1341 EXPECT_TRUE(did_request_animate_); | 1351 EXPECT_TRUE(did_request_animate_); |
1342 | 1352 |
1343 did_request_redraw_ = false; | 1353 did_request_redraw_ = false; |
1344 did_request_animate_ = false; | 1354 did_request_animate_ = false; |
1345 did_request_commit_ = false; | 1355 did_request_commit_ = false; |
1346 host_impl_->Animate(end_time); | 1356 host_impl_->Animate(end_time); |
1347 EXPECT_TRUE(did_request_commit_); | 1357 EXPECT_TRUE(did_request_commit_); |
1348 EXPECT_FALSE(did_request_animate_); | 1358 EXPECT_FALSE(did_request_animate_); |
(...skipping 5922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7271 // surface. | 7281 // surface. |
7272 EXPECT_EQ(0, num_lost_surfaces_); | 7282 EXPECT_EQ(0, num_lost_surfaces_); |
7273 host_impl_->DidLoseOutputSurface(); | 7283 host_impl_->DidLoseOutputSurface(); |
7274 EXPECT_EQ(1, num_lost_surfaces_); | 7284 EXPECT_EQ(1, num_lost_surfaces_); |
7275 host_impl_->DidLoseOutputSurface(); | 7285 host_impl_->DidLoseOutputSurface(); |
7276 EXPECT_LE(1, num_lost_surfaces_); | 7286 EXPECT_LE(1, num_lost_surfaces_); |
7277 } | 7287 } |
7278 | 7288 |
7279 } // namespace | 7289 } // namespace |
7280 } // namespace cc | 7290 } // namespace cc |
OLD | NEW |