| 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 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "CCGraphicsContext.h" | 9 #include "CCGraphicsContext.h" |
| 10 #include "CCThreadedTest.h" | 10 #include "CCThreadedTest.h" |
| (...skipping 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3176 private: | 3176 private: |
| 3177 int m_numCommitComplete; | 3177 int m_numCommitComplete; |
| 3178 int m_numDrawLayers; | 3178 int m_numDrawLayers; |
| 3179 }; | 3179 }; |
| 3180 | 3180 |
| 3181 TEST_F(LayerTreeHostTestContinuousAnimate, runMultiThread) | 3181 TEST_F(LayerTreeHostTestContinuousAnimate, runMultiThread) |
| 3182 { | 3182 { |
| 3183 runTest(true); | 3183 runTest(true); |
| 3184 } | 3184 } |
| 3185 | 3185 |
| 3186 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { |
| 3187 public: |
| 3188 LayerTreeHostTestDeferCommits() |
| 3189 : m_numCommitsDeferred(0) |
| 3190 , m_numCompleteCommits(0) |
| 3191 { |
| 3192 } |
| 3193 |
| 3194 virtual void beginTest() OVERRIDE |
| 3195 { |
| 3196 postSetNeedsCommitToMainThread(); |
| 3197 } |
| 3198 |
| 3199 virtual void didDeferCommit() OVERRIDE |
| 3200 { |
| 3201 m_numCommitsDeferred++; |
| 3202 m_layerTreeHost->setDeferCommits(false); |
| 3203 } |
| 3204 |
| 3205 virtual void didCommit() OVERRIDE |
| 3206 { |
| 3207 m_numCompleteCommits++; |
| 3208 switch (m_numCompleteCommits) { |
| 3209 case 1: |
| 3210 EXPECT_EQ(0, m_numCommitsDeferred); |
| 3211 m_layerTreeHost->setDeferCommits(true); |
| 3212 postSetNeedsCommitToMainThread(); |
| 3213 break; |
| 3214 case 2: |
| 3215 endTest(); |
| 3216 break; |
| 3217 default: |
| 3218 NOTREACHED(); |
| 3219 break; |
| 3220 } |
| 3221 } |
| 3222 |
| 3223 virtual void afterTest() OVERRIDE |
| 3224 { |
| 3225 EXPECT_EQ(1, m_numCommitsDeferred); |
| 3226 EXPECT_EQ(2, m_numCompleteCommits); |
| 3227 } |
| 3228 |
| 3229 private: |
| 3230 int m_numCommitsDeferred; |
| 3231 int m_numCompleteCommits; |
| 3232 }; |
| 3233 |
| 3234 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
| 3235 { |
| 3236 runTest(true); |
| 3237 } |
| 3238 |
| 3186 } // namespace | 3239 } // namespace |
| OLD | NEW |