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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include <gmock/gmock.h> | 26 #include <gmock/gmock.h> |
27 #include <public/Platform.h> | 27 #include <public/Platform.h> |
28 #include <public/WebCompositorSupport.h> | 28 #include <public/WebCompositorSupport.h> |
29 #include <public/WebFilterOperation.h> | 29 #include <public/WebFilterOperation.h> |
30 #include <public/WebFilterOperations.h> | 30 #include <public/WebFilterOperations.h> |
31 #include <public/WebThread.h> | 31 #include <public/WebThread.h> |
32 #include <wtf/Locker.h> | 32 #include <wtf/Locker.h> |
33 #include <wtf/PassRefPtr.h> | 33 #include <wtf/PassRefPtr.h> |
34 #include <wtf/Vector.h> | 34 #include <wtf/Vector.h> |
35 | 35 |
36 using namespace WebCore; | 36 using namespace cc; |
37 using namespace WebKit; | 37 using namespace WebKit; |
38 | 38 |
39 namespace WebKitTests { | 39 namespace WebKitTests { |
40 | 40 |
41 PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFake
WebGraphicsContext3DWithTextureTracking::create(Attributes attrs) | 41 PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFake
WebGraphicsContext3DWithTextureTracking::create(Attributes attrs) |
42 { | 42 { |
43 return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(at
trs)); | 43 return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(at
trs)); |
44 } | 44 } |
45 | 45 |
46 WebGLId CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture() | 46 WebGLId CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return 1.0 / 60; | 125 return 1.0 / 60; |
126 } | 126 } |
127 | 127 |
128 MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const CCLayer
TreeSettings& settings, CCLayerTreeHostImplClient* client) | 128 MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const CCLayer
TreeSettings& settings, CCLayerTreeHostImplClient* client) |
129 : CCLayerTreeHostImpl(settings, client) | 129 : CCLayerTreeHostImpl(settings, client) |
130 , m_testHooks(testHooks) | 130 , m_testHooks(testHooks) |
131 { | 131 { |
132 } | 132 } |
133 | 133 |
134 // Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl. | 134 // Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl. |
135 class MockLayerTreeHost : public WebCore::CCLayerTreeHost { | 135 class MockLayerTreeHost : public cc::CCLayerTreeHost { |
136 public: | 136 public: |
137 static PassOwnPtr<MockLayerTreeHost> create(TestHooks* testHooks, WebCore::C
CLayerTreeHostClient* client, PassRefPtr<WebCore::LayerChromium> rootLayer, cons
t WebCore::CCLayerTreeSettings& settings) | 137 static PassOwnPtr<MockLayerTreeHost> create(TestHooks* testHooks, cc::CCLaye
rTreeHostClient* client, PassRefPtr<cc::LayerChromium> rootLayer, const cc::CCLa
yerTreeSettings& settings) |
138 { | 138 { |
139 OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(t
estHooks, client, settings))); | 139 OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(t
estHooks, client, settings))); |
140 bool success = layerTreeHost->initialize(); | 140 bool success = layerTreeHost->initialize(); |
141 EXPECT_TRUE(success); | 141 EXPECT_TRUE(success); |
142 layerTreeHost->setRootLayer(rootLayer); | 142 layerTreeHost->setRootLayer(rootLayer); |
143 | 143 |
144 // LayerTreeHostImpl won't draw if it has 1x1 viewport. | 144 // LayerTreeHostImpl won't draw if it has 1x1 viewport. |
145 layerTreeHost->setViewportSize(IntSize(1, 1), IntSize(1, 1)); | 145 layerTreeHost->setViewportSize(IntSize(1, 1), IntSize(1, 1)); |
146 | 146 |
147 layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks); | 147 layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks); |
148 | 148 |
149 return layerTreeHost.release(); | 149 return layerTreeHost.release(); |
150 } | 150 } |
151 | 151 |
152 virtual PassOwnPtr<WebCore::CCLayerTreeHostImpl> createLayerTreeHostImpl(Web
Core::CCLayerTreeHostImplClient* client) | 152 virtual PassOwnPtr<cc::CCLayerTreeHostImpl> createLayerTreeHostImpl(cc::CCLa
yerTreeHostImplClient* client) |
153 { | 153 { |
154 return MockLayerTreeHostImpl::create(m_testHooks, settings(), client); | 154 return MockLayerTreeHostImpl::create(m_testHooks, settings(), client); |
155 } | 155 } |
156 | 156 |
157 virtual void didAddAnimation() OVERRIDE | 157 virtual void didAddAnimation() OVERRIDE |
158 { | 158 { |
159 CCLayerTreeHost::didAddAnimation(); | 159 CCLayerTreeHost::didAddAnimation(); |
160 m_testHooks->didAddAnimation(); | 160 m_testHooks->didAddAnimation(); |
161 } | 161 } |
162 | 162 |
163 private: | 163 private: |
164 MockLayerTreeHost(TestHooks* testHooks, WebCore::CCLayerTreeHostClient* clie
nt, const WebCore::CCLayerTreeSettings& settings) | 164 MockLayerTreeHost(TestHooks* testHooks, cc::CCLayerTreeHostClient* client, c
onst cc::CCLayerTreeSettings& settings) |
165 : CCLayerTreeHost(client, settings) | 165 : CCLayerTreeHost(client, settings) |
166 , m_testHooks(testHooks) | 166 , m_testHooks(testHooks) |
167 { | 167 { |
168 } | 168 } |
169 | 169 |
170 TestHooks* m_testHooks; | 170 TestHooks* m_testHooks; |
171 }; | 171 }; |
172 | 172 |
173 // Implementation of CCLayerTreeHost callback interface. | 173 // Implementation of CCLayerTreeHost callback interface. |
174 class MockLayerTreeHostClient : public MockCCLayerTreeHostClient { | 174 class MockLayerTreeHostClient : public MockCCLayerTreeHostClient { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 if (m_timedOut) { | 541 if (m_timedOut) { |
542 FAIL() << "Test timed out"; | 542 FAIL() << "Test timed out"; |
543 Platform::current()->compositorSupport()->shutdown(); | 543 Platform::current()->compositorSupport()->shutdown(); |
544 return; | 544 return; |
545 } | 545 } |
546 afterTest(); | 546 afterTest(); |
547 Platform::current()->compositorSupport()->shutdown(); | 547 Platform::current()->compositorSupport()->shutdown(); |
548 } | 548 } |
549 | 549 |
550 } // namespace WebKitTests | 550 } // namespace WebKitTests |
OLD | NEW |