OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_owner.h" | 5 #include "ui/compositor/layer_owner.h" |
6 | 6 |
7 #include "base/test/null_task_runner.h" | 7 #include "base/test/null_task_runner.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 LayerOwnerTestWithCompositor::~LayerOwnerTestWithCompositor() { | 60 LayerOwnerTestWithCompositor::~LayerOwnerTestWithCompositor() { |
61 } | 61 } |
62 | 62 |
63 void LayerOwnerTestWithCompositor::SetUp() { | 63 void LayerOwnerTestWithCompositor::SetUp() { |
64 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
65 new base::NullTaskRunner(); | 65 new base::NullTaskRunner(); |
66 | 66 |
67 ui::ContextFactory* context_factory = | 67 ui::ContextFactory* context_factory = |
68 ui::InitializeContextFactoryForTests(false); | 68 ui::InitializeContextFactoryForTests(false); |
69 | 69 |
70 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, | 70 compositor_.reset(new ui::Compositor(context_factory, task_runner)); |
71 context_factory, task_runner)); | 71 compositor_->OnAcceleratedWidgetAvailable(gfx::kNullAcceleratedWidget); |
72 } | 72 } |
73 | 73 |
74 void LayerOwnerTestWithCompositor::TearDown() { | 74 void LayerOwnerTestWithCompositor::TearDown() { |
75 compositor_.reset(); | 75 compositor_.reset(); |
76 ui::TerminateContextFactoryForTests(); | 76 ui::TerminateContextFactoryForTests(); |
77 } | 77 } |
78 | 78 |
79 } // namespace | 79 } // namespace |
80 | 80 |
81 TEST(LayerOwnerTest, RecreateLayerHonorsAnimationTargets) { | 81 TEST(LayerOwnerTest, RecreateLayerHonorsAnimationTargets) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 animation.AddObserver(observer.get()); | 211 animation.AddObserver(observer.get()); |
212 gfx::Transform transform; | 212 gfx::Transform transform; |
213 transform.Scale(0.5f, 0.5f); | 213 transform.Scale(0.5f, 0.5f); |
214 child->SetTransform(transform); | 214 child->SetTransform(transform); |
215 } | 215 } |
216 | 216 |
217 scoped_ptr<Layer> layer_copy = owner.RecreateLayer(); | 217 scoped_ptr<Layer> layer_copy = owner.RecreateLayer(); |
218 } | 218 } |
219 | 219 |
220 } // namespace ui | 220 } // namespace ui |
OLD | NEW |