| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "CCLayerIterator.h" | 7 #include "CCLayerIterator.h" |
| 8 | 8 |
| 9 #include "CCLayerTreeHostCommon.h" | 9 #include "CCLayerTreeHostCommon.h" |
| 10 #include "LayerChromium.h" | 10 #include "LayerChromium.h" |
| 11 #include <gmock/gmock.h> | 11 #include <gmock/gmock.h> |
| 12 #include <gtest/gtest.h> | 12 #include <gtest/gtest.h> |
| 13 #include <public/WebTransformationMatrix.h> | 13 #include <public/WebTransformationMatrix.h> |
| 14 | 14 |
| 15 using namespace WebCore; | 15 using namespace cc; |
| 16 using WebKit::WebTransformationMatrix; | 16 using WebKit::WebTransformationMatrix; |
| 17 using ::testing::Mock; | 17 using ::testing::Mock; |
| 18 using ::testing::_; | 18 using ::testing::_; |
| 19 using ::testing::AtLeast; | 19 using ::testing::AtLeast; |
| 20 using ::testing::AnyNumber; | 20 using ::testing::AnyNumber; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class TestLayerChromium : public LayerChromium { | 24 class TestLayerChromium : public LayerChromium { |
| 25 public: | 25 public: |
| 26 static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLaye
rChromium()); } | 26 static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLaye
rChromium()); } |
| 27 | 27 |
| 28 int m_countRepresentingTargetSurface; | 28 int m_countRepresentingTargetSurface; |
| 29 int m_countRepresentingContributingSurface; | 29 int m_countRepresentingContributingSurface; |
| 30 int m_countRepresentingItself; | 30 int m_countRepresentingItself; |
| 31 | 31 |
| 32 virtual bool drawsContent() const OVERRIDE { return m_drawsContent; } | 32 virtual bool drawsContent() const OVERRIDE { return m_drawsContent; } |
| 33 void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; } | 33 void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 TestLayerChromium() | 36 TestLayerChromium() |
| 37 : LayerChromium() | 37 : LayerChromium() |
| 38 , m_drawsContent(true) | 38 , m_drawsContent(true) |
| 39 { | 39 { |
| 40 setBounds(IntSize(100, 100)); | 40 setBounds(IntSize(100, 100)); |
| 41 setPosition(IntPoint::zero()); | 41 setPosition(IntPoint()); |
| 42 setAnchorPoint(IntPoint::zero()); | 42 setAnchorPoint(IntPoint()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool m_drawsContent; | 45 bool m_drawsContent; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 #define EXPECT_COUNT(layer, target, contrib, itself) \ | 48 #define EXPECT_COUNT(layer, target, contrib, itself) \ |
| 49 EXPECT_EQ(target, layer->m_countRepresentingTargetSurface); \ | 49 EXPECT_EQ(target, layer->m_countRepresentingTargetSurface); \ |
| 50 EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \ | 50 EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \ |
| 51 EXPECT_EQ(itself, layer->m_countRepresentingItself); | 51 EXPECT_EQ(itself, layer->m_countRepresentingItself); |
| 52 | 52 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 EXPECT_COUNT(root2, 10, 11, -1); | 246 EXPECT_COUNT(root2, 10, 11, -1); |
| 247 EXPECT_COUNT(root21, -1, -1, 9); | 247 EXPECT_COUNT(root21, -1, -1, 9); |
| 248 EXPECT_COUNT(root22, 7, 8, 6); | 248 EXPECT_COUNT(root22, 7, 8, 6); |
| 249 EXPECT_COUNT(root221, -1, -1, 5); | 249 EXPECT_COUNT(root221, -1, -1, 5); |
| 250 EXPECT_COUNT(root23, 3, 4, 2); | 250 EXPECT_COUNT(root23, 3, 4, 2); |
| 251 EXPECT_COUNT(root231, -1, -1, 1); | 251 EXPECT_COUNT(root231, -1, -1, 1); |
| 252 EXPECT_COUNT(root3, -1, -1, 0); | 252 EXPECT_COUNT(root3, -1, -1, 0); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| OLD | NEW |