| 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 #ifndef CC_TEST_LAYER_TREE_TEST_H_ | 5 #ifndef CC_TEST_LAYER_TREE_TEST_H_ |
| 6 #define CC_TEST_LAYER_TREE_TEST_H_ | 6 #define CC_TEST_LAYER_TREE_TEST_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "cc/animation/animation_delegate.h" | 10 #include "cc/animation/animation_delegate.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void DispatchSetNeedsUpdateLayers(); | 108 void DispatchSetNeedsUpdateLayers(); |
| 109 void DispatchSetNeedsRedraw(); | 109 void DispatchSetNeedsRedraw(); |
| 110 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); | 110 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 111 void DispatchSetVisible(bool visible); | 111 void DispatchSetVisible(bool visible); |
| 112 void DispatchSetNextCommitForcesRedraw(); | 112 void DispatchSetNextCommitForcesRedraw(); |
| 113 void DispatchDidAddAnimation(); | 113 void DispatchDidAddAnimation(); |
| 114 void DispatchCompositeImmediately(); | 114 void DispatchCompositeImmediately(); |
| 115 void DispatchNextCommitWaitsForActivation(); | 115 void DispatchNextCommitWaitsForActivation(); |
| 116 | 116 |
| 117 void SetOutputSurfaceOnLayerTreeHost( | 117 void SetOutputSurfaceOnLayerTreeHost( |
| 118 scoped_ptr<OutputSurface> output_surface); | 118 std::unique_ptr<OutputSurface> output_surface); |
| 119 scoped_ptr<OutputSurface> ReleaseOutputSurfaceOnLayerTreeHost(); | 119 std::unique_ptr<OutputSurface> ReleaseOutputSurfaceOnLayerTreeHost(); |
| 120 void SetVisibleOnLayerTreeHost(bool visible); | 120 void SetVisibleOnLayerTreeHost(bool visible); |
| 121 | 121 |
| 122 virtual void AfterTest() = 0; | 122 virtual void AfterTest() = 0; |
| 123 virtual void WillBeginTest(); | 123 virtual void WillBeginTest(); |
| 124 virtual void BeginTest() = 0; | 124 virtual void BeginTest() = 0; |
| 125 virtual void SetupTree(); | 125 virtual void SetupTree(); |
| 126 | 126 |
| 127 virtual void RunTest(CompositorMode mode, bool delegating_renderer); | 127 virtual void RunTest(CompositorMode mode, bool delegating_renderer); |
| 128 | 128 |
| 129 bool HasImplThread() const { return !!impl_thread_; } | 129 bool HasImplThread() const { return !!impl_thread_; } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 void DestroyLayerTreeHost(); | 163 void DestroyLayerTreeHost(); |
| 164 void DestroyRemoteClientHost() override; | 164 void DestroyRemoteClientHost() override; |
| 165 | 165 |
| 166 void CreateRemoteClientHost( | 166 void CreateRemoteClientHost( |
| 167 const proto::CompositorMessageToImpl& proto) override; | 167 const proto::CompositorMessageToImpl& proto) override; |
| 168 | 168 |
| 169 // By default, output surface recreation is synchronous. | 169 // By default, output surface recreation is synchronous. |
| 170 void RequestNewOutputSurface() override; | 170 void RequestNewOutputSurface() override; |
| 171 // Override this for pixel tests, where you need a real output surface. | 171 // Override this for pixel tests, where you need a real output surface. |
| 172 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); | 172 virtual std::unique_ptr<OutputSurface> CreateOutputSurface(); |
| 173 // Override this for unit tests, which should not produce pixel output. | 173 // Override this for unit tests, which should not produce pixel output. |
| 174 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); | 174 virtual std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface(); |
| 175 | 175 |
| 176 TestWebGraphicsContext3D* TestContext(); | 176 TestWebGraphicsContext3D* TestContext(); |
| 177 | 177 |
| 178 TestGpuMemoryBufferManager* GetTestGpuMemoryBufferManager() { | 178 TestGpuMemoryBufferManager* GetTestGpuMemoryBufferManager() { |
| 179 return gpu_memory_buffer_manager_.get(); | 179 return gpu_memory_buffer_manager_.get(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool IsRemoteTest() const; | 182 bool IsRemoteTest() const; |
| 183 | 183 |
| 184 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl); | 184 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl); |
| 185 | 185 |
| 186 private: | 186 private: |
| 187 LayerTreeSettings settings_; | 187 LayerTreeSettings settings_; |
| 188 | 188 |
| 189 CompositorMode mode_; | 189 CompositorMode mode_; |
| 190 | 190 |
| 191 scoped_ptr<LayerTreeHostClientForTesting> client_; | 191 std::unique_ptr<LayerTreeHostClientForTesting> client_; |
| 192 scoped_ptr<LayerTreeHost> layer_tree_host_; | 192 std::unique_ptr<LayerTreeHost> layer_tree_host_; |
| 193 | 193 |
| 194 // The LayerTreeHost created by the cc embedder on the client in remote mode. | 194 // The LayerTreeHost created by the cc embedder on the client in remote mode. |
| 195 scoped_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_; | 195 std::unique_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_; |
| 196 | 196 |
| 197 FakeOutputSurface* output_surface_; | 197 FakeOutputSurface* output_surface_; |
| 198 FakeExternalBeginFrameSource* external_begin_frame_source_; | 198 FakeExternalBeginFrameSource* external_begin_frame_source_; |
| 199 RemoteProtoChannelBridge remote_proto_channel_bridge_; | 199 RemoteProtoChannelBridge remote_proto_channel_bridge_; |
| 200 | 200 |
| 201 bool beginning_; | 201 bool beginning_; |
| 202 bool end_when_begin_returns_; | 202 bool end_when_begin_returns_; |
| 203 bool timed_out_; | 203 bool timed_out_; |
| 204 bool scheduled_; | 204 bool scheduled_; |
| 205 bool started_; | 205 bool started_; |
| 206 bool ended_; | 206 bool ended_; |
| 207 bool delegating_renderer_; | 207 bool delegating_renderer_; |
| 208 | 208 |
| 209 int timeout_seconds_; | 209 int timeout_seconds_; |
| 210 | 210 |
| 211 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 211 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 212 scoped_ptr<base::Thread> impl_thread_; | 212 std::unique_ptr<base::Thread> impl_thread_; |
| 213 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 213 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 214 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 214 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 215 scoped_ptr<TestTaskGraphRunner> task_graph_runner_; | 215 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; |
| 216 base::CancelableClosure timeout_; | 216 base::CancelableClosure timeout_; |
| 217 scoped_refptr<TestContextProvider> compositor_contexts_; | 217 scoped_refptr<TestContextProvider> compositor_contexts_; |
| 218 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; | 218 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; |
| 219 base::WeakPtrFactory<LayerTreeTest> weak_factory_; | 219 base::WeakPtrFactory<LayerTreeTest> weak_factory_; |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 } // namespace cc | 222 } // namespace cc |
| 223 | 223 |
| 224 #define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ | 224 #define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ |
| 225 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \ | 225 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 271 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 272 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 272 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
| 273 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 273 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
| 274 | 274 |
| 275 // Some tests want to control when notify ready for activation occurs, | 275 // Some tests want to control when notify ready for activation occurs, |
| 276 // but this is not supported in the single-threaded case. | 276 // but this is not supported in the single-threaded case. |
| 277 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 277 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
| 278 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 278 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 279 | 279 |
| 280 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 280 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
| OLD | NEW |