| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/layers/layer_settings.h" | |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/graphics/paint/PaintArtifact.h" | 9 #include "platform/graphics/paint/PaintArtifact.h" |
| 11 #include "platform/testing/PictureMatchers.h" | 10 #include "platform/testing/PictureMatchers.h" |
| 12 #include "platform/testing/TestPaintArtifact.h" | 11 #include "platform/testing/TestPaintArtifact.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 ASSERT_EQ(1u, clipLayer2->children().size()); | 301 ASSERT_EQ(1u, clipLayer2->children().size()); |
| 303 cc::Layer* blackLayer = clipLayer2->child_at(0); | 302 cc::Layer* blackLayer = clipLayer2->child_at(0); |
| 304 EXPECT_THAT(blackLayer->GetPicture(), | 303 EXPECT_THAT(blackLayer->GetPicture(), |
| 305 Pointee(drawsRectangle(FloatRect(0, 0, 640, 480), Color::black))); | 304 Pointee(drawsRectangle(FloatRect(0, 0, 640, 480), Color::black))); |
| 306 EXPECT_EQ(translation(-400, 0), blackLayer->transform()); | 305 EXPECT_EQ(translation(-400, 0), blackLayer->transform()); |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 | 308 |
| 310 TEST_F(PaintArtifactCompositorTest, ForeignLayerPassesThrough) | 309 TEST_F(PaintArtifactCompositorTest, ForeignLayerPassesThrough) |
| 311 { | 310 { |
| 312 scoped_refptr<cc::Layer> layer = cc::Layer::Create(cc::LayerSettings()); | 311 scoped_refptr<cc::Layer> layer = cc::Layer::Create(); |
| 313 | 312 |
| 314 TestPaintArtifact artifact; | 313 TestPaintArtifact artifact; |
| 315 artifact.chunk(PaintChunkProperties()) | 314 artifact.chunk(PaintChunkProperties()) |
| 316 .foreignLayer(FloatPoint(50, 100), IntSize(400, 300), layer); | 315 .foreignLayer(FloatPoint(50, 100), IntSize(400, 300), layer); |
| 317 update(artifact.build()); | 316 update(artifact.build()); |
| 318 | 317 |
| 319 ASSERT_EQ(1u, rootLayer()->children().size()); | 318 ASSERT_EQ(1u, rootLayer()->children().size()); |
| 320 EXPECT_EQ(layer, rootLayer()->child_at(0)); | 319 EXPECT_EQ(layer, rootLayer()->child_at(0)); |
| 321 EXPECT_EQ(gfx::Size(400, 300), layer->bounds()); | 320 EXPECT_EQ(gfx::Size(400, 300), layer->bounds()); |
| 322 EXPECT_EQ(translation(50, 100), layer->transform()); | 321 EXPECT_EQ(translation(50, 100), layer->transform()); |
| 323 } | 322 } |
| 324 | 323 |
| 325 } // namespace | 324 } // namespace |
| 326 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |