| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer_animator.h" | 5 #include "ui/compositor/layer_animator.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 }; | 2517 }; |
| 2518 | 2518 |
| 2519 TEST(LayerAnimatorTest, LayerAnimatorCollectionTickTime) { | 2519 TEST(LayerAnimatorTest, LayerAnimatorCollectionTickTime) { |
| 2520 Layer layer; | 2520 Layer layer; |
| 2521 LayerAnimator* animator = layer.GetAnimator(); | 2521 LayerAnimator* animator = layer.GetAnimator(); |
| 2522 CollectionLayerAnimationDelegate delegate; | 2522 CollectionLayerAnimationDelegate delegate; |
| 2523 animator->SetDelegate(&delegate); | 2523 animator->SetDelegate(&delegate); |
| 2524 | 2524 |
| 2525 LayerAnimatorCollection* collection = delegate.GetLayerAnimatorCollection(); | 2525 LayerAnimatorCollection* collection = delegate.GetLayerAnimatorCollection(); |
| 2526 base::TimeTicks null; | 2526 base::TimeTicks null; |
| 2527 collection->Progress(null); | 2527 collection->OnAnimationStep(null); |
| 2528 EXPECT_TRUE(collection->last_tick_time().is_null()); | 2528 EXPECT_TRUE(collection->last_tick_time().is_null()); |
| 2529 | 2529 |
| 2530 // Adding an animator to the collection should update the last tick time. | 2530 // Adding an animator to the collection should update the last tick time. |
| 2531 collection->StartAnimator(layer.GetAnimator()); | 2531 collection->StartAnimator(layer.GetAnimator()); |
| 2532 EXPECT_TRUE(collection->HasActiveAnimators()); | 2532 EXPECT_TRUE(collection->HasActiveAnimators()); |
| 2533 EXPECT_FALSE(collection->last_tick_time().is_null()); | 2533 EXPECT_FALSE(collection->last_tick_time().is_null()); |
| 2534 | 2534 |
| 2535 collection->StopAnimator(layer.GetAnimator()); | 2535 collection->StopAnimator(layer.GetAnimator()); |
| 2536 EXPECT_FALSE(collection->HasActiveAnimators()); | 2536 EXPECT_FALSE(collection->HasActiveAnimators()); |
| 2537 } | 2537 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 | 2614 |
| 2615 root_2.Add(&layer); | 2615 root_2.Add(&layer); |
| 2616 EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators()); | 2616 EXPECT_FALSE(compositor_1->layer_animator_collection()->HasActiveAnimators()); |
| 2617 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators()); | 2617 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators()); |
| 2618 host_2.reset(); | 2618 host_2.reset(); |
| 2619 host_1.reset(); | 2619 host_1.reset(); |
| 2620 TerminateContextFactoryForTests(); | 2620 TerminateContextFactoryForTests(); |
| 2621 } | 2621 } |
| 2622 | 2622 |
| 2623 } // namespace ui | 2623 } // namespace ui |
| OLD | NEW |