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 "cc/tiled_layer.h" | 7 #include "cc/tiled_layer.h" |
8 | 8 |
9 #include "CCOverdrawMetrics.h" | 9 #include "CCOverdrawMetrics.h" |
10 #include "CCRenderingStats.h" | 10 #include "CCRenderingStats.h" |
11 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread | 11 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread |
12 #include "CCTextureUpdateController.h" | 12 #include "CCTextureUpdateController.h" |
13 #include "cc/bitmap_canvas_layer_texture_updater.h" | 13 #include "cc/bitmap_canvas_layer_texture_updater.h" |
14 #include "cc/layer_painter.h" | 14 #include "cc/layer_painter.h" |
15 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
16 #include "cc/test/fake_graphics_context.h" | 16 #include "cc/test/fake_graphics_context.h" |
17 #include "cc/test/fake_layer_tree_host_client.h" | 17 #include "cc/test/fake_layer_tree_host_client.h" |
18 #include "cc/test/geometry_test_utils.h" | 18 #include "cc/test/geometry_test_utils.h" |
19 #include "cc/test/tiled_layer_test_common.h" | 19 #include "cc/test/tiled_layer_test_common.h" |
20 #include "cc/test/web_compositor_initializer.h" | 20 #include "cc/test/web_compositor_initializer.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include <public/WebTransformationMatrix.h> | 22 #include <public/WebTransformationMatrix.h> |
23 | 23 |
24 using namespace cc; | 24 using namespace cc; |
25 using namespace WebKitTests; | 25 using namespace WebKitTests; |
26 using namespace WTF; | |
27 using WebKit::WebTransformationMatrix; | 26 using WebKit::WebTransformationMatrix; |
28 | 27 |
29 namespace { | 28 namespace { |
30 | 29 |
31 class TestCCOcclusionTracker : public CCOcclusionTracker { | 30 class TestCCOcclusionTracker : public CCOcclusionTracker { |
32 public: | 31 public: |
33 TestCCOcclusionTracker() | 32 TestCCOcclusionTracker() |
34 : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true) | 33 : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true) |
35 , m_layerClipRectInTarget(IntRect(0, 0, 1000, 1000)) | 34 , m_layerClipRectInTarget(IntRect(0, 0, 1000, 1000)) |
36 { | 35 { |
(...skipping 20 matching lines...) Expand all Loading... |
57 , m_occlusion(0) | 56 , m_occlusion(0) |
58 { | 57 { |
59 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; |
60 m_resourceProvider = CCResourceProvider::create(m_context.get()); | 59 m_resourceProvider = CCResourceProvider::create(m_context.get()); |
61 } | 60 } |
62 | 61 |
63 virtual ~TiledLayerChromiumTest() | 62 virtual ~TiledLayerChromiumTest() |
64 { | 63 { |
65 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.
get()); | 64 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.
get()); |
66 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 65 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; |
67 m_resourceProvider.clear(); | 66 m_resourceProvider.reset(); |
68 } | 67 } |
69 | 68 |
70 // Helper classes and functions that set the current thread to be the impl t
hread | 69 // Helper classes and functions that set the current thread to be the impl t
hread |
71 // before doing the action that they wrap. | 70 // before doing the action that they wrap. |
72 class ScopedFakeCCTiledLayerImpl { | 71 class ScopedFakeCCTiledLayerImpl { |
73 public: | 72 public: |
74 ScopedFakeCCTiledLayerImpl(int id) | 73 ScopedFakeCCTiledLayerImpl(int id) |
75 { | 74 { |
76 DebugScopedSetImplThread implThread; | 75 DebugScopedSetImplThread implThread; |
77 m_layerImpl = new FakeCCTiledLayerImpl(id); | 76 m_layerImpl = new FakeCCTiledLayerImpl(id); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 layerPushPropertiesTo(layer1, layerImpl1); | 153 layerPushPropertiesTo(layer1, layerImpl1); |
155 if (layer2) | 154 if (layer2) |
156 layerPushPropertiesTo(layer2, layerImpl2); | 155 layerPushPropertiesTo(layer2, layerImpl2); |
157 | 156 |
158 return needsUpdate; | 157 return needsUpdate; |
159 } | 158 } |
160 | 159 |
161 public: | 160 public: |
162 WebKitTests::WebCompositorInitializer m_compositorInitializer; | 161 WebKitTests::WebCompositorInitializer m_compositorInitializer; |
163 scoped_ptr<CCGraphicsContext> m_context; | 162 scoped_ptr<CCGraphicsContext> m_context; |
164 OwnPtr<CCResourceProvider> m_resourceProvider; | 163 scoped_ptr<CCResourceProvider> m_resourceProvider; |
165 scoped_ptr<CCTextureUpdateQueue> m_queue; | 164 scoped_ptr<CCTextureUpdateQueue> m_queue; |
166 CCRenderingStats m_stats; | 165 CCRenderingStats m_stats; |
167 FakeTextureUploader m_uploader; | 166 FakeTextureUploader m_uploader; |
168 CCPriorityCalculator m_priorityCalculator; | 167 CCPriorityCalculator m_priorityCalculator; |
169 scoped_ptr<CCPrioritizedTextureManager> m_textureManager; | 168 scoped_ptr<CCPrioritizedTextureManager> m_textureManager; |
170 TestCCOcclusionTracker* m_occlusion; | 169 TestCCOcclusionTracker* m_occlusion; |
171 }; | 170 }; |
172 | 171 |
173 TEST_F(TiledLayerChromiumTest, pushDirtyTiles) | 172 TEST_F(TiledLayerChromiumTest, pushDirtyTiles) |
174 { | 173 { |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 updateTextures(); | 1549 updateTextures(); |
1551 | 1550 |
1552 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1551 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
1553 layer->setNeedsDisplayRect(layerRect); | 1552 layer->setNeedsDisplayRect(layerRect); |
1554 layer->update(*m_queue.get(), 0, m_stats); | 1553 layer->update(*m_queue.get(), 0, m_stats); |
1555 | 1554 |
1556 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1555 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1557 } | 1556 } |
1558 | 1557 |
1559 } // namespace | 1558 } // namespace |
OLD | NEW |