| 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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
| 8 | 8 |
| 9 #include "CCGeometryTestUtils.h" | 9 #include "CCGeometryTestUtils.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| 11 #include "CCLayerTreeHostImpl.h" | 11 #include "CCLayerTreeHostImpl.h" |
| 12 #include "CCOcclusionTrackerTestCommon.h" | 12 #include "CCOcclusionTrackerTestCommon.h" |
| 13 #include "CCSettings.h" | 13 #include "CCSettings.h" |
| 14 #include "CCSingleThreadProxy.h" | 14 #include "CCSingleThreadProxy.h" |
| 15 #include "CCTextureUpdateQueue.h" | 15 #include "CCTextureUpdateQueue.h" |
| 16 #include "CCThreadedTest.h" | 16 #include "CCThreadedTest.h" |
| 17 #include "CCTimingFunction.h" | 17 #include "CCTimingFunction.h" |
| 18 #include "ContentLayerChromium.h" | 18 #include "ContentLayerChromium.h" |
| 19 #include "ContentLayerChromiumClient.h" | 19 #include "ContentLayerChromiumClient.h" |
| 20 #include "Extensions3DChromium.h" | 20 #include "Extensions3DChromium.h" |
| 21 #include "FakeWebCompositorOutputSurface.h" | 21 #include "FakeWebCompositorOutputSurface.h" |
| 22 #include <gmock/gmock.h> | 22 #include <gmock/gmock.h> |
| 23 #include <public/Platform.h> | 23 #include <public/Platform.h> |
| 24 #include <public/WebLayerScrollClient.h> | 24 #include <public/WebLayerScrollClient.h> |
| 25 #include <public/WebSize.h> | 25 #include <public/WebSize.h> |
| 26 #include <wtf/MainThread.h> | |
| 27 #include <wtf/OwnArrayPtr.h> | 26 #include <wtf/OwnArrayPtr.h> |
| 28 | 27 |
| 29 using namespace WebCore; | 28 using namespace WebCore; |
| 30 using namespace WebKit; | 29 using namespace WebKit; |
| 31 using namespace WebKitTests; | 30 using namespace WebKitTests; |
| 32 | 31 |
| 33 namespace { | 32 namespace { |
| 34 | 33 |
| 35 class CCLayerTreeHostTest : public CCThreadedTest { }; | 34 class CCLayerTreeHostTest : public CCThreadedTest { }; |
| 36 | 35 |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 { | 1072 { |
| 1074 } | 1073 } |
| 1075 | 1074 |
| 1076 virtual void beginTest() OVERRIDE | 1075 virtual void beginTest() OVERRIDE |
| 1077 { | 1076 { |
| 1078 m_layerTreeHost->rootLayer()->setScrollable(true); | 1077 m_layerTreeHost->rootLayer()->setScrollable(true); |
| 1079 m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint()); | 1078 m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint()); |
| 1080 postSetNeedsRedrawToMainThread(); | 1079 postSetNeedsRedrawToMainThread(); |
| 1081 } | 1080 } |
| 1082 | 1081 |
| 1083 static void requestStartPageScaleAnimation(void* self) | 1082 void requestStartPageScaleAnimation() |
| 1084 { | 1083 { |
| 1085 CCLayerTreeHostTestStartPageScaleAnimation* test = static_cast<CCLayerTr
eeHostTestStartPageScaleAnimation*>(self); | 1084 layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0); |
| 1086 if (test->layerTreeHost()) | |
| 1087 test->layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.2
5, 0); | |
| 1088 } | 1085 } |
| 1089 | 1086 |
| 1090 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE | 1087 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE |
| 1091 { | 1088 { |
| 1092 impl->rootLayer()->setScrollable(true); | 1089 impl->rootLayer()->setScrollable(true); |
| 1093 impl->rootLayer()->setScrollPosition(IntPoint()); | 1090 impl->rootLayer()->setScrollPosition(IntPoint()); |
| 1094 impl->setPageScaleFactorAndLimits(impl->pageScale(), 0.5, 2); | 1091 impl->setPageScaleFactorAndLimits(impl->pageScale(), 0.5, 2); |
| 1095 | 1092 |
| 1096 // We request animation only once. | 1093 // We request animation only once. |
| 1097 if (!m_animationRequested) { | 1094 if (!m_animationRequested) { |
| 1098 callOnMainThread(CCLayerTreeHostTestStartPageScaleAnimation::request
StartPageScaleAnimation, this); | 1095 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHos
tTestStartPageScaleAnimation::requestStartPageScaleAnimation)); |
| 1099 m_animationRequested = true; | 1096 m_animationRequested = true; |
| 1100 } | 1097 } |
| 1101 } | 1098 } |
| 1102 | 1099 |
| 1103 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV
ERRIDE | 1100 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OV
ERRIDE |
| 1104 { | 1101 { |
| 1105 IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); | 1102 IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); |
| 1106 m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); | 1103 m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); |
| 1107 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); | 1104 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); |
| 1108 } | 1105 } |
| (...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2990 int m_numCommitComplete; | 2987 int m_numCommitComplete; |
| 2991 int m_numDrawLayers; | 2988 int m_numDrawLayers; |
| 2992 }; | 2989 }; |
| 2993 | 2990 |
| 2994 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) | 2991 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) |
| 2995 { | 2992 { |
| 2996 runTest(true); | 2993 runTest(true); |
| 2997 } | 2994 } |
| 2998 | 2995 |
| 2999 } // namespace | 2996 } // namespace |
| OLD | NEW |