| 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 "cc/bitmap_content_layer_updater.h" | 9 #include "cc/bitmap_content_layer_updater.h" |
| 10 #include "cc/layer_painter.h" | 10 #include "cc/layer_painter.h" |
| 11 #include "cc/overdraw_metrics.h" | 11 #include "cc/overdraw_metrics.h" |
| 12 #include "cc/rendering_stats.h" | 12 #include "cc/rendering_stats.h" |
| 13 #include "cc/resource_update_controller.h" | 13 #include "cc/resource_update_controller.h" |
| 14 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 14 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
| 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" | |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include <public/WebTransformationMatrix.h> | 21 #include <public/WebTransformationMatrix.h> |
| 23 | 22 |
| 24 using namespace cc; | 23 using namespace cc; |
| 25 using namespace WebKitTests; | 24 using namespace WebKitTests; |
| 26 using WebKit::WebTransformationMatrix; | 25 using WebKit::WebTransformationMatrix; |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 class TestOcclusionTracker : public OcclusionTracker { | 29 class TestOcclusionTracker : public OcclusionTracker { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 protected: | 41 protected: |
| 43 virtual IntRect layerClipRectInTarget(const Layer* layer) const OVERRIDE { r
eturn m_layerClipRectInTarget; } | 42 virtual IntRect layerClipRectInTarget(const Layer* layer) const OVERRIDE { r
eturn m_layerClipRectInTarget; } |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 IntRect m_layerClipRectInTarget; | 45 IntRect m_layerClipRectInTarget; |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 class TiledLayerTest : public testing::Test { | 48 class TiledLayerTest : public testing::Test { |
| 50 public: | 49 public: |
| 51 TiledLayerTest() | 50 TiledLayerTest() |
| 52 : m_compositorInitializer(0) | 51 : m_context(WebKit::createFakeGraphicsContext()) |
| 53 , m_context(WebKit::createFakeGraphicsContext()) | |
| 54 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) | 52 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) |
| 55 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024,
Renderer::ContentPool)) | 53 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024,
Renderer::ContentPool)) |
| 56 , m_occlusion(0) | 54 , m_occlusion(0) |
| 57 { | 55 { |
| 58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 56 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; |
| 59 m_resourceProvider = ResourceProvider::create(m_context.get()); | 57 m_resourceProvider = ResourceProvider::create(m_context.get()); |
| 60 } | 58 } |
| 61 | 59 |
| 62 virtual ~TiledLayerTest() | 60 virtual ~TiledLayerTest() |
| 63 { | 61 { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 updateTextures(); | 148 updateTextures(); |
| 151 if (layer1) | 149 if (layer1) |
| 152 layerPushPropertiesTo(layer1, layerImpl1); | 150 layerPushPropertiesTo(layer1, layerImpl1); |
| 153 if (layer2) | 151 if (layer2) |
| 154 layerPushPropertiesTo(layer2, layerImpl2); | 152 layerPushPropertiesTo(layer2, layerImpl2); |
| 155 | 153 |
| 156 return needsUpdate; | 154 return needsUpdate; |
| 157 } | 155 } |
| 158 | 156 |
| 159 public: | 157 public: |
| 160 WebKitTests::WebCompositorInitializer m_compositorInitializer; | |
| 161 scoped_ptr<GraphicsContext> m_context; | 158 scoped_ptr<GraphicsContext> m_context; |
| 162 scoped_ptr<ResourceProvider> m_resourceProvider; | 159 scoped_ptr<ResourceProvider> m_resourceProvider; |
| 163 scoped_ptr<ResourceUpdateQueue> m_queue; | 160 scoped_ptr<ResourceUpdateQueue> m_queue; |
| 164 RenderingStats m_stats; | 161 RenderingStats m_stats; |
| 165 PriorityCalculator m_priorityCalculator; | 162 PriorityCalculator m_priorityCalculator; |
| 166 scoped_ptr<PrioritizedTextureManager> m_textureManager; | 163 scoped_ptr<PrioritizedTextureManager> m_textureManager; |
| 167 TestOcclusionTracker* m_occlusion; | 164 TestOcclusionTracker* m_occlusion; |
| 168 }; | 165 }; |
| 169 | 166 |
| 170 TEST_F(TiledLayerTest, pushDirtyTiles) | 167 TEST_F(TiledLayerTest, pushDirtyTiles) |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 updateTextures(); | 1616 updateTextures(); |
| 1620 | 1617 |
| 1621 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1618 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
| 1622 layer->setNeedsDisplayRect(layerRect); | 1619 layer->setNeedsDisplayRect(layerRect); |
| 1623 layer->update(*m_queue.get(), 0, m_stats); | 1620 layer->update(*m_queue.get(), 0, m_stats); |
| 1624 | 1621 |
| 1625 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1622 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
| 1626 } | 1623 } |
| 1627 | 1624 |
| 1628 } // namespace | 1625 } // namespace |
| OLD | NEW |