| 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 |
| 34 TestHooks::~TestHooks() { } |
| 35 |
| 32 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl:
:FrameData&, bool) | 36 bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl:
:FrameData&, bool) |
| 33 { | 37 { |
| 34 return true; | 38 return true; |
| 35 } | 39 } |
| 36 | 40 |
| 37 bool TestHooks::canActivatePendingTree() | 41 bool TestHooks::canActivatePendingTree() |
| 38 { | 42 { |
| 39 return true; | 43 return true; |
| 40 } | 44 } |
| 41 | 45 |
| 42 scoped_ptr<OutputSurface> TestHooks::createOutputSurface() | 46 scoped_ptr<OutputSurface> TestHooks::createOutputSurface() |
| 43 { | 47 { |
| 44 return createFakeOutputSurface(); | 48 return createFakeOutputSurface(); |
| 45 } | 49 } |
| 46 | 50 |
| 51 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForMainThread() |
| 52 { |
| 53 return OffscreenContext3dForCompositorThread(); |
| 54 } |
| 55 |
| 56 WebKit::WebGraphicsContext3D* TestHooks::OffscreenContext3dForCompositorThread() |
| 57 { |
| 58 if (m_offscreenContext3d) |
| 59 return m_offscreenContext3d.get(); |
| 60 |
| 61 WebKit::WebGraphicsContext3D::Attributes attrs; |
| 62 m_offscreenContext3d = FakeWebGraphicsContext3D::Create(attrs).PassAs<WebKit
::WebGraphicsContext3D>(); |
| 63 return m_offscreenContext3d.get(); |
| 64 } |
| 65 |
| 47 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH
ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy*
proxy) | 66 scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH
ooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy*
proxy) |
| 48 { | 67 { |
| 49 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client
, proxy)); | 68 return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client
, proxy)); |
| 50 } | 69 } |
| 51 | 70 |
| 52 void MockLayerTreeHostImpl::beginCommit() | 71 void MockLayerTreeHostImpl::beginCommit() |
| 53 { | 72 { |
| 54 LayerTreeHostImpl::beginCommit(); | 73 LayerTreeHostImpl::beginCommit(); |
| 55 m_testHooks->beginCommitOnThread(this); | 74 m_testHooks->beginCommitOnThread(this); |
| 56 } | 75 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE | 211 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE |
| 193 { | 212 { |
| 194 return m_testHooks->createOutputSurface(); | 213 return m_testHooks->createOutputSurface(); |
| 195 } | 214 } |
| 196 | 215 |
| 197 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE | 216 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE |
| 198 { | 217 { |
| 199 m_testHooks->didRecreateOutputSurface(succeeded); | 218 m_testHooks->didRecreateOutputSurface(succeeded); |
| 200 } | 219 } |
| 201 | 220 |
| 221 virtual void willRetryRecreateOutputSurface() OVERRIDE |
| 222 { |
| 223 m_testHooks->willRetryRecreateOutputSurface(); |
| 224 } |
| 225 |
| 226 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForMainThread() OVER
RIDE |
| 227 { |
| 228 return m_testHooks->OffscreenContext3dForMainThread(); |
| 229 } |
| 230 |
| 231 virtual WebKit::WebGraphicsContext3D* OffscreenContext3dForCompositorThread(
) OVERRIDE |
| 232 { |
| 233 return m_testHooks->OffscreenContext3dForCompositorThread(); |
| 234 } |
| 235 |
| 202 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE | 236 virtual scoped_ptr<InputHandler> createInputHandler() OVERRIDE |
| 203 { | 237 { |
| 204 return scoped_ptr<InputHandler>(); | 238 return scoped_ptr<InputHandler>(); |
| 205 } | 239 } |
| 206 | 240 |
| 207 virtual void willCommit() OVERRIDE | 241 virtual void willCommit() OVERRIDE |
| 208 { | 242 { |
| 209 } | 243 } |
| 210 | 244 |
| 211 virtual void didCommit() OVERRIDE | 245 virtual void didCommit() OVERRIDE |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 345 |
| 312 m_started = true; | 346 m_started = true; |
| 313 m_beginning = true; | 347 m_beginning = true; |
| 314 setupTree(); | 348 setupTree(); |
| 315 m_layerTreeHost->setSurfaceReady(); | 349 m_layerTreeHost->setSurfaceReady(); |
| 316 beginTest(); | 350 beginTest(); |
| 317 m_beginning = false; | 351 m_beginning = false; |
| 318 if (m_endWhenBeginReturns) | 352 if (m_endWhenBeginReturns) |
| 319 realEndTest(); | 353 realEndTest(); |
| 320 | 354 |
| 321 LayerTreeHost::setNeedsFilterContext(false); | |
| 322 | |
| 323 // Allow commits to happen once beginTest() has had a chance to post tasks | 355 // Allow commits to happen once beginTest() has had a chance to post tasks |
| 324 // so that those tasks will happen before the first commit. | 356 // so that those tasks will happen before the first commit. |
| 325 if (m_layerTreeHost) | 357 if (m_layerTreeHost) |
| 326 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t
rue); | 358 static_cast<MockLayerTreeHost*>(m_layerTreeHost.get())->setTestStarted(t
rue); |
| 327 } | 359 } |
| 328 | 360 |
| 329 void ThreadedTest::setupTree() | 361 void ThreadedTest::setupTree() |
| 330 { | 362 { |
| 331 if (!m_layerTreeHost->rootLayer()) { | 363 if (!m_layerTreeHost->rootLayer()) { |
| 332 scoped_refptr<Layer> rootLayer = Layer::create(); | 364 scoped_refptr<Layer> rootLayer = Layer::create(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 ASSERT_FALSE(m_layerTreeHost.get()); | 475 ASSERT_FALSE(m_layerTreeHost.get()); |
| 444 m_client.reset(); | 476 m_client.reset(); |
| 445 if (m_timedOut) { | 477 if (m_timedOut) { |
| 446 FAIL() << "Test timed out"; | 478 FAIL() << "Test timed out"; |
| 447 return; | 479 return; |
| 448 } | 480 } |
| 449 afterTest(); | 481 afterTest(); |
| 450 } | 482 } |
| 451 | 483 |
| 452 } // namespace cc | 484 } // namespace cc |
| OLD | NEW |