| 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_COMMON_H_ | 5 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| 6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 6 #define CC_TEST_LAYER_TREE_TEST_COMMON_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/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 virtual void runTest(bool threaded); | 125 virtual void runTest(bool threaded); |
| 126 | 126 |
| 127 Thread* implThread() { return proxy() ? proxy()->implThread() : 0; } | 127 Thread* implThread() { return proxy() ? proxy()->implThread() : 0; } |
| 128 Proxy* proxy() const { return m_layerTreeHost ? m_layerTreeHost->proxy() : 0
; } | 128 Proxy* proxy() const { return m_layerTreeHost ? m_layerTreeHost->proxy() : 0
; } |
| 129 | 129 |
| 130 LayerTreeSettings m_settings; | 130 LayerTreeSettings m_settings; |
| 131 scoped_ptr<MockLayerImplTreeHostClient> m_client; | 131 scoped_ptr<MockLayerImplTreeHostClient> m_client; |
| 132 scoped_ptr<LayerTreeHost> m_layerTreeHost; | 132 scoped_ptr<LayerTreeHost> m_layerTreeHost; |
| 133 | 133 |
| 134 bool testEnded() const { return m_ended; } |
| 135 |
| 134 private: | 136 private: |
| 135 bool m_beginning; | 137 bool m_beginning; |
| 136 bool m_endWhenBeginReturns; | 138 bool m_endWhenBeginReturns; |
| 137 bool m_timedOut; | 139 bool m_timedOut; |
| 138 bool m_scheduled; | 140 bool m_scheduled; |
| 139 bool m_started; | 141 bool m_started; |
| 142 bool m_ended; |
| 140 | 143 |
| 141 scoped_ptr<Thread> m_mainCCThread; | 144 scoped_ptr<Thread> m_mainCCThread; |
| 142 scoped_ptr<base::Thread> m_implThread; | 145 scoped_ptr<base::Thread> m_implThread; |
| 143 base::CancelableClosure m_timeout; | 146 base::CancelableClosure m_timeout; |
| 144 base::WeakPtr<ThreadedTest> m_mainThreadWeakPtr; | 147 base::WeakPtr<ThreadedTest> m_mainThreadWeakPtr; |
| 145 base::WeakPtrFactory<ThreadedTest> m_weakFactory; | 148 base::WeakPtrFactory<ThreadedTest> m_weakFactory; |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 class ThreadedTestThreadOnly : public ThreadedTest { | 151 class ThreadedTestThreadOnly : public ThreadedTest { |
| 149 public: | 152 public: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 194 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 192 { \ | 195 { \ |
| 193 runTest(true); \ | 196 runTest(true); \ |
| 194 } | 197 } |
| 195 | 198 |
| 196 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 199 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 197 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 200 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 198 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 201 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 199 | 202 |
| 200 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 203 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| OLD | NEW |