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 "testing/gmock/include/gmock/gmock.h" |
| 10 #include "third_party/khronos/GLES2/gl2.h" |
| 11 #include "third_party/khronos/GLES2/gl2ext.h" |
9 #include "CCGeometryTestUtils.h" | 12 #include "CCGeometryTestUtils.h" |
10 #include "CCGraphicsContext.h" | 13 #include "CCGraphicsContext.h" |
11 #include "CCLayerTreeHostImpl.h" | 14 #include "CCLayerTreeHostImpl.h" |
12 #include "CCOcclusionTrackerTestCommon.h" | 15 #include "CCOcclusionTrackerTestCommon.h" |
13 #include "CCSettings.h" | 16 #include "CCSettings.h" |
14 #include "CCSingleThreadProxy.h" | 17 #include "CCSingleThreadProxy.h" |
15 #include "CCTextureUpdateQueue.h" | 18 #include "CCTextureUpdateQueue.h" |
16 #include "CCThreadedTest.h" | 19 #include "CCThreadedTest.h" |
17 #include "CCTimingFunction.h" | 20 #include "CCTimingFunction.h" |
18 #include "ContentLayerChromium.h" | 21 #include "ContentLayerChromium.h" |
19 #include "ContentLayerChromiumClient.h" | 22 #include "ContentLayerChromiumClient.h" |
20 #include "Extensions3DChromium.h" | |
21 #include "FakeWebCompositorOutputSurface.h" | 23 #include "FakeWebCompositorOutputSurface.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | |
23 #include <public/Platform.h> | 24 #include <public/Platform.h> |
24 #include <public/WebLayerScrollClient.h> | 25 #include <public/WebLayerScrollClient.h> |
25 #include <public/WebSize.h> | 26 #include <public/WebSize.h> |
26 #include <wtf/OwnArrayPtr.h> | 27 #include <wtf/OwnArrayPtr.h> |
27 | 28 |
28 using namespace cc; | 29 using namespace cc; |
29 using namespace WebKit; | 30 using namespace WebKit; |
30 using namespace WebKitTests; | 31 using namespace WebKitTests; |
31 | 32 |
32 namespace { | 33 namespace { |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 | 2414 |
2414 private: | 2415 private: |
2415 EvictionTestLayer() : LayerChromium() { } | 2416 EvictionTestLayer() : LayerChromium() { } |
2416 virtual ~EvictionTestLayer() { } | 2417 virtual ~EvictionTestLayer() { } |
2417 | 2418 |
2418 void createTextureIfNeeded() | 2419 void createTextureIfNeeded() |
2419 { | 2420 { |
2420 if (m_texture.get()) | 2421 if (m_texture.get()) |
2421 return; | 2422 return; |
2422 m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextur
eManager()); | 2423 m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextur
eManager()); |
2423 m_texture->setDimensions(IntSize(10, 10), cc::GraphicsContext3D::RGBA); | 2424 m_texture->setDimensions(IntSize(10, 10), GL_RGBA); |
2424 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 2425 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
2425 } | 2426 } |
2426 | 2427 |
2427 scoped_ptr<CCPrioritizedTexture> m_texture; | 2428 scoped_ptr<CCPrioritizedTexture> m_texture; |
2428 SkBitmap m_bitmap; | 2429 SkBitmap m_bitmap; |
2429 }; | 2430 }; |
2430 | 2431 |
2431 class EvictionTestLayerImpl : public CCLayerImpl { | 2432 class EvictionTestLayerImpl : public CCLayerImpl { |
2432 public: | 2433 public: |
2433 static scoped_ptr<EvictionTestLayerImpl> create(int id) | 2434 static scoped_ptr<EvictionTestLayerImpl> create(int id) |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { | 2718 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { |
2718 public: | 2719 public: |
2719 static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) | 2720 static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) |
2720 { | 2721 { |
2721 return adoptPtr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausin
gLostContext(attrs)); | 2722 return adoptPtr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausin
gLostContext(attrs)); |
2722 } | 2723 } |
2723 | 2724 |
2724 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback
) { m_contextLostCallback = callback; } | 2725 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback
) { m_contextLostCallback = callback; } |
2725 virtual bool isContextLost() { return m_isContextLost; } | 2726 virtual bool isContextLost() { return m_isContextLost; } |
2726 | 2727 |
2727 virtual void beginQueryEXT(GC3Denum, WebGLId) { } | 2728 virtual void beginQueryEXT(WGC3Denum, WebGLId) { } |
2728 virtual void endQueryEXT(GC3Denum) | 2729 virtual void endQueryEXT(WGC3Denum) |
2729 { | 2730 { |
2730 // Lose context. | 2731 // Lose context. |
2731 if (!m_isContextLost) { | 2732 if (!m_isContextLost) { |
2732 m_contextLostCallback->onContextLost(); | 2733 m_contextLostCallback->onContextLost(); |
2733 m_isContextLost = true; | 2734 m_isContextLost = true; |
2734 } | 2735 } |
2735 } | 2736 } |
2736 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum pname, GC3Duint* params) | 2737 virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum pname, WGC3Duint* param
s) |
2737 { | 2738 { |
2738 // Context is lost. We need to behave as if result is available. | 2739 // Context is lost. We need to behave as if result is available. |
2739 if (pname == Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT) | 2740 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) |
2740 *params = 1; | 2741 *params = 1; |
2741 } | 2742 } |
2742 | 2743 |
2743 private: | 2744 private: |
2744 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At
tributes attrs) | 2745 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At
tributes attrs) |
2745 : CompositorFakeWebGraphicsContext3D(attrs) | 2746 : CompositorFakeWebGraphicsContext3D(attrs) |
2746 , m_contextLostCallback(0) | 2747 , m_contextLostCallback(0) |
2747 , m_isContextLost(false) { } | 2748 , m_isContextLost(false) { } |
2748 | 2749 |
2749 WebGraphicsContextLostCallback* m_contextLostCallback; | 2750 WebGraphicsContextLostCallback* m_contextLostCallback; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 int m_numCommitComplete; | 2968 int m_numCommitComplete; |
2968 int m_numDrawLayers; | 2969 int m_numDrawLayers; |
2969 }; | 2970 }; |
2970 | 2971 |
2971 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) | 2972 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) |
2972 { | 2973 { |
2973 runTest(true); | 2974 runTest(true); |
2974 } | 2975 } |
2975 | 2976 |
2976 } // namespace | 2977 } // namespace |
OLD | NEW |