| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/output/begin_frame_args.h" | 8 #include "cc/output/begin_frame_args.h" |
| 9 #include "cc/test/begin_frame_args_test.h" | 9 #include "cc/test/begin_frame_args_test.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 compositor_.reset(); | 49 compositor_.reset(); |
| 50 ui::TerminateContextFactoryForTests(); | 50 ui::TerminateContextFactoryForTests(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 base::SingleThreadTaskRunner* task_runner() { return task_runner_.get(); } | 54 base::SingleThreadTaskRunner* task_runner() { return task_runner_.get(); } |
| 55 ui::Compositor* compositor() { return compositor_.get(); } | 55 ui::Compositor* compositor() { return compositor_.get(); } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 59 scoped_ptr<ui::Compositor> compositor_; | 59 std::unique_ptr<ui::Compositor> compositor_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(CompositorTest); | 61 DISALLOW_COPY_AND_ASSIGN(CompositorTest); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 TEST_F(CompositorTest, LocksTimeOut) { | 66 TEST_F(CompositorTest, LocksTimeOut) { |
| 67 scoped_refptr<ui::CompositorLock> lock; | 67 scoped_refptr<ui::CompositorLock> lock; |
| 68 { | 68 { |
| 69 base::RunLoop run_loop; | 69 base::RunLoop run_loop; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 TEST_F(CompositorTest, ReleaseWidgetWithOutputSurfaceNeverCreated) { | 197 TEST_F(CompositorTest, ReleaseWidgetWithOutputSurfaceNeverCreated) { |
| 198 compositor()->SetVisible(false); | 198 compositor()->SetVisible(false); |
| 199 EXPECT_EQ(gfx::kNullAcceleratedWidget, | 199 EXPECT_EQ(gfx::kNullAcceleratedWidget, |
| 200 compositor()->ReleaseAcceleratedWidget()); | 200 compositor()->ReleaseAcceleratedWidget()); |
| 201 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 201 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| 202 compositor()->SetVisible(true); | 202 compositor()->SetVisible(true); |
| 203 } | 203 } |
| 204 | 204 |
| 205 TEST_F(CompositorTest, CreateAndReleaseOutputSurface) { | 205 TEST_F(CompositorTest, CreateAndReleaseOutputSurface) { |
| 206 scoped_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR)); | 206 std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR)); |
| 207 root_layer->SetBounds(gfx::Rect(10, 10)); | 207 root_layer->SetBounds(gfx::Rect(10, 10)); |
| 208 compositor()->SetRootLayer(root_layer.get()); | 208 compositor()->SetRootLayer(root_layer.get()); |
| 209 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10)); | 209 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10)); |
| 210 DCHECK(compositor()->IsVisible()); | 210 DCHECK(compositor()->IsVisible()); |
| 211 compositor()->ScheduleDraw(); | 211 compositor()->ScheduleDraw(); |
| 212 DrawWaiterForTest::WaitForCompositingEnded(compositor()); | 212 DrawWaiterForTest::WaitForCompositingEnded(compositor()); |
| 213 compositor()->SetVisible(false); | 213 compositor()->SetVisible(false); |
| 214 EXPECT_EQ(gfx::kNullAcceleratedWidget, | 214 EXPECT_EQ(gfx::kNullAcceleratedWidget, |
| 215 compositor()->ReleaseAcceleratedWidget()); | 215 compositor()->ReleaseAcceleratedWidget()); |
| 216 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 216 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| 217 compositor()->SetVisible(true); | 217 compositor()->SetVisible(true); |
| 218 compositor()->ScheduleDraw(); | 218 compositor()->ScheduleDraw(); |
| 219 DrawWaiterForTest::WaitForCompositingEnded(compositor()); | 219 DrawWaiterForTest::WaitForCompositingEnded(compositor()); |
| 220 compositor()->SetRootLayer(nullptr); | 220 compositor()->SetRootLayer(nullptr); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace ui | 223 } // namespace ui |
| OLD | NEW |