| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void DispatchNextCommitWaitsForActivation(); | 117 void DispatchNextCommitWaitsForActivation(); |
| 118 | 118 |
| 119 std::unique_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); |
| 128 | 128 |
| 129 bool HasImplThread() const { return !!impl_thread_; } | 129 bool HasImplThread() const { return !!impl_thread_; } |
| 130 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { | 130 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { |
| 131 return impl_task_runner_.get(); | 131 return impl_task_runner_.get(); |
| 132 } | 132 } |
| 133 base::SingleThreadTaskRunner* MainThreadTaskRunner() { | 133 base::SingleThreadTaskRunner* MainThreadTaskRunner() { |
| 134 return main_task_runner_.get(); | 134 return main_task_runner_.get(); |
| 135 } | 135 } |
| 136 Proxy* proxy() const { | 136 Proxy* proxy() const { |
| 137 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; | 137 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; |
| 138 } | 138 } |
| 139 Proxy* remote_client_proxy() const; | 139 Proxy* remote_client_proxy() const; |
| 140 TaskRunnerProvider* task_runner_provider() const; | 140 TaskRunnerProvider* task_runner_provider() const; |
| 141 TaskGraphRunner* task_graph_runner() const { | 141 TaskGraphRunner* task_graph_runner() const { |
| 142 return task_graph_runner_.get(); | 142 return task_graph_runner_.get(); |
| 143 } | 143 } |
| 144 bool TestEnded() const { return ended_; } | 144 bool TestEnded() const { return ended_; } |
| 145 | 145 |
| 146 LayerTreeHost* layer_tree_host(); | 146 LayerTreeHost* layer_tree_host(); |
| 147 LayerTreeHost* remote_client_layer_tree_host(); | 147 LayerTreeHost* remote_client_layer_tree_host(); |
| 148 bool delegating_renderer() const { return delegating_renderer_; } | |
| 149 SharedBitmapManager* shared_bitmap_manager() const { | 148 SharedBitmapManager* shared_bitmap_manager() const { |
| 150 return shared_bitmap_manager_.get(); | 149 return shared_bitmap_manager_.get(); |
| 151 } | 150 } |
| 152 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { | 151 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { |
| 153 return gpu_memory_buffer_manager_.get(); | 152 return gpu_memory_buffer_manager_.get(); |
| 154 } | 153 } |
| 155 | 154 |
| 156 void DestroyLayerTreeHost(); | 155 void DestroyLayerTreeHost(); |
| 157 void DestroyRemoteClientHost() override; | 156 void DestroyRemoteClientHost() override; |
| 158 | 157 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 RemoteProtoChannelBridge remote_proto_channel_bridge_; | 193 RemoteProtoChannelBridge remote_proto_channel_bridge_; |
| 195 | 194 |
| 196 std::unique_ptr<ImageSerializationProcessor> image_serialization_processor_; | 195 std::unique_ptr<ImageSerializationProcessor> image_serialization_processor_; |
| 197 | 196 |
| 198 bool beginning_ = false; | 197 bool beginning_ = false; |
| 199 bool end_when_begin_returns_ = false; | 198 bool end_when_begin_returns_ = false; |
| 200 bool timed_out_ = false; | 199 bool timed_out_ = false; |
| 201 bool scheduled_ = false; | 200 bool scheduled_ = false; |
| 202 bool started_ = false; | 201 bool started_ = false; |
| 203 bool ended_ = false; | 202 bool ended_ = false; |
| 204 bool delegating_renderer_ = false; | |
| 205 | 203 |
| 206 int timeout_seconds_ = false; | 204 int timeout_seconds_ = false; |
| 207 | 205 |
| 208 std::unique_ptr<LayerTreeTestDelegatingOutputSurfaceClient> | 206 std::unique_ptr<LayerTreeTestDelegatingOutputSurfaceClient> |
| 209 delegating_output_surface_client_; | 207 delegating_output_surface_client_; |
| 210 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 208 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 211 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 209 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 212 std::unique_ptr<base::Thread> impl_thread_; | 210 std::unique_ptr<base::Thread> impl_thread_; |
| 213 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; | 211 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 214 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 212 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 215 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; | 213 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; |
| 216 base::CancelableClosure timeout_; | 214 base::CancelableClosure timeout_; |
| 217 scoped_refptr<TestContextProvider> compositor_contexts_; | 215 scoped_refptr<TestContextProvider> compositor_contexts_; |
| 218 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; | 216 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; |
| 219 base::WeakPtrFactory<LayerTreeTest> weak_factory_; | 217 base::WeakPtrFactory<LayerTreeTest> weak_factory_; |
| 220 }; | 218 }; |
| 221 | 219 |
| 222 } // namespace cc | 220 } // namespace cc |
| 223 | 221 |
| 224 #define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ | |
| 225 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \ | |
| 226 RunTest(CompositorMode::SINGLE_THREADED, false); \ | |
| 227 } \ | |
| 228 class SingleThreadDirectImplNeedsSemicolon##TEST_FIXTURE_NAME {} | |
| 229 | |
| 230 #define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 222 #define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 231 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DelegatingRenderer) { \ | 223 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DelegatingRenderer) { \ |
| 232 RunTest(CompositorMode::SINGLE_THREADED, true); \ | 224 RunTest(CompositorMode::SINGLE_THREADED); \ |
| 233 } \ | 225 } \ |
| 234 class SingleThreadDelegatingImplNeedsSemicolon##TEST_FIXTURE_NAME {} | 226 class SingleThreadDelegatingImplNeedsSemicolon##TEST_FIXTURE_NAME {} |
| 235 | 227 |
| 236 #define MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ | |
| 237 TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer) { \ | |
| 238 RunTest(CompositorMode::THREADED, false); \ | |
| 239 } \ | |
| 240 class MultiThreadDirectImplNeedsSemicolon##TEST_FIXTURE_NAME {} | |
| 241 | |
| 242 #define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 228 #define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 243 TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DelegatingRenderer) { \ | 229 TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DelegatingRenderer) { \ |
| 244 RunTest(CompositorMode::THREADED, true); \ | 230 RunTest(CompositorMode::THREADED); \ |
| 245 } \ | 231 } \ |
| 246 class MultiThreadDelegatingImplNeedsSemicolon##TEST_FIXTURE_NAME {} | 232 class MultiThreadDelegatingImplNeedsSemicolon##TEST_FIXTURE_NAME {} |
| 247 | 233 |
| 248 #define SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ | |
| 249 SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | |
| 250 MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) | |
| 251 | |
| 252 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 234 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 253 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \ | 235 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \ |
| 254 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 236 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 255 | 237 |
| 256 // Some tests want to control when notify ready for activation occurs, | 238 // Some tests want to control when notify ready for activation occurs, |
| 257 // but this is not supported in the single-threaded case. | 239 // but this is not supported in the single-threaded case. |
| 258 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 240 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
| 259 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 241 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 260 | 242 |
| 261 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 243 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
| OLD | NEW |