Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ui/compositor/layer_animator_unittest.cc

Issue 2563783002: ui + mus: Split ContextFactory into ContextFactory(Client) and ContextFactoryPrivate (Closed)
Patch Set: Restore mash Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/compositor/compositor_unittest.cc ('k') | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators()); 2600 collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators());
2601 2601
2602 layer.reset(); 2602 layer.reset();
2603 EXPECT_EQ(NULL, animator->delegate()); 2603 EXPECT_EQ(NULL, animator->delegate());
2604 EXPECT_FALSE( 2604 EXPECT_FALSE(
2605 collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators()); 2605 collection_delegate.GetLayerAnimatorCollection()->HasActiveAnimators());
2606 } 2606 }
2607 2607
2608 TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) { 2608 TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) {
2609 bool enable_pixel_output = false; 2609 bool enable_pixel_output = false;
2610 ui::ContextFactory* context_factory = 2610 ui::ContextFactory* context_factory = nullptr;
2611 InitializeContextFactoryForTests(enable_pixel_output); 2611 ui::ContextFactoryPrivate* context_factory_private = nullptr;
2612 InitializeContextFactoryForTests(enable_pixel_output, &context_factory,
2613 &context_factory_private);
2612 const gfx::Rect bounds(10, 10, 100, 100); 2614 const gfx::Rect bounds(10, 10, 100, 100);
2613 std::unique_ptr<TestCompositorHost> host_1( 2615 std::unique_ptr<TestCompositorHost> host_1(TestCompositorHost::Create(
2614 TestCompositorHost::Create(bounds, context_factory)); 2616 bounds, context_factory, context_factory_private));
2615 std::unique_ptr<TestCompositorHost> host_2( 2617 std::unique_ptr<TestCompositorHost> host_2(TestCompositorHost::Create(
2616 TestCompositorHost::Create(bounds, context_factory)); 2618 bounds, context_factory, context_factory_private));
2617 host_1->Show(); 2619 host_1->Show();
2618 host_2->Show(); 2620 host_2->Show();
2619 2621
2620 Compositor* compositor_1 = host_1->GetCompositor(); 2622 Compositor* compositor_1 = host_1->GetCompositor();
2621 Layer root_1; 2623 Layer root_1;
2622 compositor_1->SetRootLayer(&root_1); 2624 compositor_1->SetRootLayer(&root_1);
2623 2625
2624 Compositor* compositor_2 = host_2->GetCompositor(); 2626 Compositor* compositor_2 = host_2->GetCompositor();
2625 Layer root_2; 2627 Layer root_2;
2626 compositor_2->SetRootLayer(&root_2); 2628 compositor_2->SetRootLayer(&root_2);
(...skipping 21 matching lines...) Expand all
2648 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators()); 2650 EXPECT_TRUE(compositor_2->layer_animator_collection()->HasActiveAnimators());
2649 EXPECT_TRUE(layer.cc_layer_for_testing()->HasTickingAnimationForTesting()); 2651 EXPECT_TRUE(layer.cc_layer_for_testing()->HasTickingAnimationForTesting());
2650 2652
2651 host_2.reset(); 2653 host_2.reset();
2652 host_1.reset(); 2654 host_1.reset();
2653 TerminateContextFactoryForTests(); 2655 TerminateContextFactoryForTests();
2654 } 2656 }
2655 2657
2656 TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) { 2658 TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) {
2657 bool enable_pixel_output = false; 2659 bool enable_pixel_output = false;
2658 ui::ContextFactory* context_factory = 2660 ui::ContextFactory* context_factory = nullptr;
2659 InitializeContextFactoryForTests(enable_pixel_output); 2661 ui::ContextFactoryPrivate* context_factory_private = nullptr;
2662 InitializeContextFactoryForTests(enable_pixel_output, &context_factory,
2663 &context_factory_private);
2660 const gfx::Rect bounds(10, 10, 100, 100); 2664 const gfx::Rect bounds(10, 10, 100, 100);
2661 std::unique_ptr<TestCompositorHost> host( 2665 std::unique_ptr<TestCompositorHost> host(TestCompositorHost::Create(
2662 TestCompositorHost::Create(bounds, context_factory)); 2666 bounds, context_factory, context_factory_private));
2663 host->Show(); 2667 host->Show();
2664 2668
2665 Compositor* compositor = host->GetCompositor(); 2669 Compositor* compositor = host->GetCompositor();
2666 2670
2667 Layer root; 2671 Layer root;
2668 compositor->SetRootLayer(&root); 2672 compositor->SetRootLayer(&root);
2669 2673
2670 Layer layer; 2674 Layer layer;
2671 root.Add(&layer); 2675 root.Add(&layer);
2672 2676
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 EXPECT_EQ(observer.last_ended_sequence(), nullptr); 2949 EXPECT_EQ(observer.last_ended_sequence(), nullptr);
2946 EXPECT_EQ(observer.last_detached_sequence(), first_sequence); 2950 EXPECT_EQ(observer.last_detached_sequence(), first_sequence);
2947 2951
2948 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch()); 2952 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch());
2949 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch()); 2953 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch());
2950 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch()); 2954 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch());
2951 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch()); 2955 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch());
2952 } 2956 }
2953 2957
2954 } // namespace ui 2958 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor_unittest.cc ('k') | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698