| 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 "cc/test/layer_tree_test_common.h" | 5 #include "cc/test/layer_tree_test_common.h" |
| 6 | 6 |
| 7 #include "cc/animation.h" | 7 #include "cc/animation.h" |
| 8 #include "cc/animation_registrar.h" | 8 #include "cc/animation_registrar.h" |
| 9 #include "cc/content_layer.h" | 9 #include "cc/content_layer.h" |
| 10 #include "cc/font_atlas.h" | 10 #include "cc/font_atlas.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "cc/timing_function.h" | 22 #include "cc/timing_function.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" |
| 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| 26 #include "ui/gfx/size_conversions.h" | 26 #include "ui/gfx/size_conversions.h" |
| 27 | 27 |
| 28 using namespace WebKit; | 28 using namespace WebKit; |
| 29 | 29 |
| 30 namespace cc { | 30 namespace cc { |
| 31 | 31 |
| 32 TestHooks::TestHooks() |
| 33 : m_fakeClient(false, // use_software_rendering |
| 34 false) // use_delegating_renderer |
| 35 { |
| 36 } |
| 37 |
| 38 TestHooks::~TestHooks() { } |
| 39 |
| 32 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl:
:FrameData&, bool) | 40 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl:
:FrameData&, bool) |
| 33 { | 41 { |
| 34 return true; | 42 return true; |
| 35 } | 43 } |
| 36 | 44 |
| 37 bool TestHooks::canActivatePendingTree() | 45 bool TestHooks::canActivatePendingTree() |
| 38 { | 46 { |
| 39 return true; | 47 return true; |
| 40 } | 48 } |
| 41 | 49 |
| 42 scoped_ptr<OutputSurface> TestHooks::createOutputSurface() | 50 scoped_ptr<OutputSurface> TestHooks::createOutputSurface() |
| 43 { | 51 { |
| 44 return createFakeOutputSurface(); | 52 return createFakeOutputSurface(); |
| 45 } | 53 } |
| 46 | 54 |
| 55 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForMainThread() |
| 56 { |
| 57 return m_fakeClient.OffscreenContext3dForMainThread(); |
| 58 } |
| 59 |
| 60 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForCompositorThread() |
| 61 { |
| 62 return m_fakeClient.OffscreenContext3dForCompositorThread(); |
| 63 } |
| 64 |
| 65 GrContext* TestHooks::OffscreenGrContextForMainThread() |
| 66 { |
| 67 return m_fakeClient.OffscreenGrContextForMainThread(); |
| 68 } |
| 69 |
| 70 GrContext* TestHooks::OffscreenGrContextForCompositorThread() |
| 71 { |
| 72 return m_fakeClient.OffscreenGrContextForCompositorThread(); |
| 73 } |
| 74 |
| 47 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH
ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy*
proxy) | 75 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH
ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy*
proxy) |
| 48 { | 76 { |
| 49 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client
, proxy)); | 77 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client
, proxy)); |
| 50 } | 78 } |
| 51 | 79 |
| 52 void MockLayerTreeHostImpl::beginCommit() | 80 void MockLayerTreeHostImpl::beginCommit() |
| 53 { | 81 { |
| 54 LayerTreeHostImpl::beginCommit(); | 82 LayerTreeHostImpl::beginCommit(); |
| 55 m_testHooks->beginCommitOnThread(this); | 83 m_testHooks->beginCommitOnThread(this); |
| 56 } | 84 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE | 214 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE |
| 187 { | 215 { |
| 188 return m_testHooks->createOutputSurface(); | 216 return m_testHooks->createOutputSurface(); |
| 189 } | 217 } |
| 190 | 218 |
| 191 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE | 219 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE |
| 192 { | 220 { |
| 193 m_testHooks->didRecreateOutputSurface(succeeded); | 221 m_testHooks->didRecreateOutputSurface(succeeded); |
| 194 } | 222 } |
| 195 | 223 |
| 224 virtual void willRetryRecreateOutputSurface() OVERRIDE |
| 225 { |
| 226 m_testHooks->willRetryRecreateOutputSurface(); |
| 227 } |
| 228 |
| 229 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForMainThread() OVER
RIDE |
| 230 { |
| 231 return m_testHooks->OffscreenContext3dForMainThread(); |
| 232 } |
| 233 |
| 234 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForCompositorThread(
) OVERRIDE |
| 235 { |
| 236 return m_testHooks->OffscreenContext3dForCompositorThread(); |
| 237 } |
| 238 |
| 239 virtual GrContext* OffscreenGrContextForMainThread() OVERRIDE |
| 240 { |
| 241 return m_testHooks->OffscreenGrContextForMainThread(); |
| 242 } |
| 243 |
| 244 virtual GrContext* OffscreenGrContextForCompositorThread() OVERRIDE |
| 245 { |
| 246 return m_testHooks->OffscreenGrContextForCompositorThread(); |
| 247 } |
| 248 |
| 196 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE | 249 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE |
| 197 { | 250 { |
| 198 return scoped_ptr<InputHandler>(); | 251 return scoped_ptr<InputHandler>(); |
| 199 } | 252 } |
| 200 | 253 |
| 201 virtual void willCommit() OVERRIDE | 254 virtual void willCommit() OVERRIDE |
| 202 { | 255 { |
| 203 } | 256 } |
| 204 | 257 |
| 205 virtual void didCommit() OVERRIDE | 258 virtual void didCommit() OVERRIDE |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 358 |
| 306 m_started = true; | 359 m_started = true; |
| 307 m_beginning = true; | 360 m_beginning = true; |
| 308 setupTree(); | 361 setupTree(); |
| 309 m_layerTreeHost->setSurfaceReady(); | 362 m_layerTreeHost->setSurfaceReady(); |
| 310 beginTest(); | 363 beginTest(); |
| 311 m_beginning = false; | 364 m_beginning = false; |
| 312 if (m_endWhenBeginReturns) | 365 if (m_endWhenBeginReturns) |
| 313 realEndTest(); | 366 realEndTest(); |
| 314 | 367 |
| 315 LayerTreeHost::setNeedsFilterContext(false); | |
| 316 | |
| 317 // Allow commits to happen once beginTest() has had a chance to post tasks | 368 // Allow commits to happen once beginTest() has had a chance to post tasks |
| 318 // so that those tasks will happen before the first commit. | 369 // so that those tasks will happen before the first commit. |
| 319 if (m_layerTreeHost) | 370 if (m_layerTreeHost) |
| 320 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t
rue); | 371 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t
rue); |
| 321 } | 372 } |
| 322 | 373 |
| 323 void ThreadedTest::setupTree() | 374 void ThreadedTest::setupTree() |
| 324 { | 375 { |
| 325 if (!m_layerTreeHost->rootLayer()) { | 376 if (!m_layerTreeHost->rootLayer()) { |
| 326 scoped_refptr<Layer> rootLayer = Layer::create(); | 377 scoped_refptr<Layer> rootLayer = Layer::create(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 ASSERT_FALSE(m_layerTreeHost.get()); | 488 ASSERT_FALSE(m_layerTreeHost.get()); |
| 438 m_client.reset(); | 489 m_client.reset(); |
| 439 if (m_timedOut) { | 490 if (m_timedOut) { |
| 440 FAIL() << "Test timed out"; | 491 FAIL() << "Test timed out"; |
| 441 return; | 492 return; |
| 442 } | 493 } |
| 443 afterTest(); | 494 afterTest(); |
| 444 } | 495 } |
| 445 | 496 |
| 446 } // namespace cc | 497 } // namespace cc |
| OLD | NEW |