| 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 "CCThreadedTest.h" | 7 #include "CCThreadedTest.h" |
| 8 | 8 |
| 9 #include "CCActiveAnimation.h" | 9 #include "CCActiveAnimation.h" |
| 10 #include "CCAnimationTestCommon.h" | 10 #include "CCAnimationTestCommon.h" |
| 11 #include "CCInputHandler.h" |
| 11 #include "CCLayerAnimationController.h" | 12 #include "CCLayerAnimationController.h" |
| 12 #include "CCLayerImpl.h" | 13 #include "CCLayerImpl.h" |
| 13 #include "CCLayerTreeHostImpl.h" | 14 #include "CCLayerTreeHostImpl.h" |
| 14 #include "CCOcclusionTrackerTestCommon.h" | 15 #include "CCOcclusionTrackerTestCommon.h" |
| 15 #include "CCScopedThreadProxy.h" | 16 #include "CCScopedThreadProxy.h" |
| 16 #include "CCSingleThreadProxy.h" | 17 #include "CCSingleThreadProxy.h" |
| 17 #include "CCTextureUpdateQueue.h" | 18 #include "CCTextureUpdateQueue.h" |
| 18 #include "CCThreadTask.h" | 19 #include "CCThreadTask.h" |
| 19 #include "CCTiledLayerTestCommon.h" | 20 #include "CCTiledLayerTestCommon.h" |
| 20 #include "CCTimingFunction.h" | 21 #include "CCTimingFunction.h" |
| 21 #include "ContentLayerChromium.h" | 22 #include "ContentLayerChromium.h" |
| 22 #include "FakeWebCompositorOutputSurface.h" | 23 #include "FakeWebCompositorOutputSurface.h" |
| 23 #include "FakeWebGraphicsContext3D.h" | 24 #include "FakeWebGraphicsContext3D.h" |
| 24 #include "LayerChromium.h" | 25 #include "LayerChromium.h" |
| 25 #include <gmock/gmock.h> | 26 #include <gmock/gmock.h> |
| 26 #include <public/Platform.h> | 27 #include <public/Platform.h> |
| 27 #include <public/WebCompositor.h> | 28 #include <public/WebCompositorSupport.h> |
| 28 #include <public/WebFilterOperation.h> | 29 #include <public/WebFilterOperation.h> |
| 29 #include <public/WebFilterOperations.h> | 30 #include <public/WebFilterOperations.h> |
| 30 #include <public/WebThread.h> | 31 #include <public/WebThread.h> |
| 31 #include <wtf/Locker.h> | 32 #include <wtf/Locker.h> |
| 32 #include <wtf/MainThread.h> | 33 #include <wtf/MainThread.h> |
| 33 #include <wtf/PassRefPtr.h> | 34 #include <wtf/PassRefPtr.h> |
| 34 #include <wtf/ThreadingPrimitives.h> | 35 #include <wtf/ThreadingPrimitives.h> |
| 35 #include <wtf/Vector.h> | 36 #include <wtf/Vector.h> |
| 36 | 37 |
| 37 using namespace WebCore; | 38 using namespace WebCore; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV
ERRIDE | 201 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV
ERRIDE |
| 201 { | 202 { |
| 202 m_testHooks->applyScrollAndScale(scrollDelta, scale); | 203 m_testHooks->applyScrollAndScale(scrollDelta, scale); |
| 203 } | 204 } |
| 204 | 205 |
| 205 virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRID
E | 206 virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRID
E |
| 206 { | 207 { |
| 207 return m_testHooks->createOutputSurface(); | 208 return m_testHooks->createOutputSurface(); |
| 208 } | 209 } |
| 209 | 210 |
| 211 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE |
| 212 { |
| 213 m_testHooks->didRecreateOutputSurface(succeeded); |
| 214 } |
| 215 |
| 216 virtual PassOwnPtr<CCInputHandler> createInputHandler() OVERRIDE |
| 217 { |
| 218 return nullptr; |
| 219 } |
| 220 |
| 210 virtual void willCommit() OVERRIDE | 221 virtual void willCommit() OVERRIDE |
| 211 { | 222 { |
| 212 } | 223 } |
| 213 | 224 |
| 214 virtual void didCommit() OVERRIDE | 225 virtual void didCommit() OVERRIDE |
| 215 { | 226 { |
| 216 m_testHooks->didCommit(); | 227 m_testHooks->didCommit(); |
| 217 } | 228 } |
| 218 | 229 |
| 219 virtual void didCommitAndDrawFrame() OVERRIDE | 230 virtual void didCommitAndDrawFrame() OVERRIDE |
| 220 { | 231 { |
| 221 m_testHooks->didCommitAndDrawFrame(); | 232 m_testHooks->didCommitAndDrawFrame(); |
| 222 } | 233 } |
| 223 | 234 |
| 224 virtual void didCompleteSwapBuffers() OVERRIDE | 235 virtual void didCompleteSwapBuffers() OVERRIDE |
| 225 { | 236 { |
| 226 } | 237 } |
| 227 | 238 |
| 228 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE | |
| 229 { | |
| 230 m_testHooks->didRecreateOutputSurface(succeeded); | |
| 231 } | |
| 232 | |
| 233 virtual void scheduleComposite() OVERRIDE | 239 virtual void scheduleComposite() OVERRIDE |
| 234 { | 240 { |
| 235 m_testHooks->scheduleComposite(); | 241 m_testHooks->scheduleComposite(); |
| 236 } | 242 } |
| 237 | 243 |
| 238 private: | 244 private: |
| 239 explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHoo
ks) { } | 245 explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHoo
ks) { } |
| 240 | 246 |
| 241 TestHooks* m_testHooks; | 247 TestHooks* m_testHooks; |
| 242 }; | 248 }; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 if (test->m_finished) | 579 if (test->m_finished) |
| 574 return; | 580 return; |
| 575 | 581 |
| 576 if (test->m_layerTreeHost) | 582 if (test->m_layerTreeHost) |
| 577 test->m_layerTreeHost->didAddAnimation(); | 583 test->m_layerTreeHost->didAddAnimation(); |
| 578 } | 584 } |
| 579 | 585 |
| 580 void CCThreadedTest::runTest(bool threaded) | 586 void CCThreadedTest::runTest(bool threaded) |
| 581 { | 587 { |
| 582 // For these tests, we will enable threaded animations. | 588 // For these tests, we will enable threaded animations. |
| 583 WebCompositor::setAcceleratedAnimationEnabled(true); | 589 Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(tru
e); |
| 584 | 590 |
| 585 if (threaded) { | 591 if (threaded) { |
| 586 m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThre
adedTest")); | 592 m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThre
adedTest")); |
| 587 WebCompositor::initialize(m_webThread.get()); | 593 Platform::current()->compositorSupport()->initialize(m_webThread.get()); |
| 588 } else | 594 } else |
| 589 WebCompositor::initialize(0); | 595 Platform::current()->compositorSupport()->initialize(0); |
| 590 | 596 |
| 591 ASSERT(CCProxy::isMainThread()); | 597 ASSERT(CCProxy::isMainThread()); |
| 592 m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); | 598 m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); |
| 593 | 599 |
| 594 initializeSettings(m_settings); | 600 initializeSettings(m_settings); |
| 595 | 601 |
| 596 m_beginTask = new BeginTask(this); | 602 m_beginTask = new BeginTask(this); |
| 597 WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0
); // postDelayedTask takes ownership of the task | 603 WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0
); // postDelayedTask takes ownership of the task |
| 598 m_timeoutTask = new TimeoutTask(this); | 604 m_timeoutTask = new TimeoutTask(this); |
| 599 WebKit::Platform::current()->currentThread()->postDelayedTask(m_timeoutTask,
5000); | 605 WebKit::Platform::current()->currentThread()->postDelayedTask(m_timeoutTask,
5000); |
| 600 WebKit::Platform::current()->currentThread()->enterRunLoop(); | 606 WebKit::Platform::current()->currentThread()->enterRunLoop(); |
| 601 | 607 |
| 602 if (m_layerTreeHost && m_layerTreeHost->rootLayer()) | 608 if (m_layerTreeHost && m_layerTreeHost->rootLayer()) |
| 603 m_layerTreeHost->rootLayer()->setLayerTreeHost(0); | 609 m_layerTreeHost->rootLayer()->setLayerTreeHost(0); |
| 604 m_layerTreeHost.clear(); | 610 m_layerTreeHost.clear(); |
| 605 | 611 |
| 606 if (m_timeoutTask) | 612 if (m_timeoutTask) |
| 607 m_timeoutTask->clearTest(); | 613 m_timeoutTask->clearTest(); |
| 608 | 614 |
| 609 if (m_endTestTask) | 615 if (m_endTestTask) |
| 610 m_endTestTask->clearTest(); | 616 m_endTestTask->clearTest(); |
| 611 | 617 |
| 612 ASSERT_FALSE(m_layerTreeHost.get()); | 618 ASSERT_FALSE(m_layerTreeHost.get()); |
| 613 m_client.clear(); | 619 m_client.clear(); |
| 614 if (m_timedOut) { | 620 if (m_timedOut) { |
| 615 FAIL() << "Test timed out"; | 621 FAIL() << "Test timed out"; |
| 616 WebCompositor::shutdown(); | 622 Platform::current()->compositorSupport()->shutdown(); |
| 617 return; | 623 return; |
| 618 } | 624 } |
| 619 afterTest(); | 625 afterTest(); |
| 620 WebCompositor::shutdown(); | 626 Platform::current()->compositorSupport()->shutdown(); |
| 621 } | 627 } |
| 622 | 628 |
| 623 } // namespace WebKitTests | 629 } // namespace WebKitTests |
| OLD | NEW |