| Index: third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| index d36cfceb8ec5d5f92d52d426651112476856aed4..3704015a18d8b08e3c9b72b37122b01198992862 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| @@ -13,10 +13,6 @@ using testing::ElementsAre;
|
| namespace blink {
|
| namespace {
|
|
|
| -// TODO(crbug.com/629946): The tests fail mysteriously on some Windows debug
|
| -// bots.
|
| -#if defined(NDEBUG) || !OS(WIN)
|
| -
|
| PaintChunkProperties rootPaintChunkProperties() {
|
| PaintChunkProperties rootProperties;
|
| rootProperties.transform = TransformPaintPropertyNode::root();
|
| @@ -34,33 +30,39 @@ class PaintChunkerTest : public testing::Test {
|
|
|
| void TearDown() override { m_featuresBackup.restore(); }
|
|
|
| + protected:
|
| + class TestDisplayItemClient : public DisplayItemClient {
|
| + String debugName() const final { return "Test"; }
|
| + LayoutRect visualRect() const final { return LayoutRect(); }
|
| + };
|
| + TestDisplayItemClient m_client;
|
| +
|
| private:
|
| RuntimeEnabledFeatures::Backup m_featuresBackup;
|
| };
|
|
|
| -class TestDisplayItem : public DisplayItem, public DisplayItemClient {
|
| +class TestDisplayItem : public DisplayItem {
|
| public:
|
| - TestDisplayItem(DisplayItem::Type type)
|
| - : DisplayItem(*this, type, sizeof(*this)) {}
|
| + TestDisplayItem(const DisplayItemClient& client, DisplayItem::Type type)
|
| + : DisplayItem(client, type, sizeof(*this)) {}
|
|
|
| void replay(GraphicsContext&) const final { NOTREACHED(); }
|
| void appendToWebDisplayItemList(const IntRect&,
|
| WebDisplayItemList*) const final {
|
| NOTREACHED();
|
| }
|
| - String debugName() const final { return "Test"; }
|
| - LayoutRect visualRect() const final { return LayoutRect(); }
|
| };
|
|
|
| class NormalTestDisplayItem : public TestDisplayItem {
|
| public:
|
| - NormalTestDisplayItem() : TestDisplayItem(DisplayItem::kDrawingFirst) {}
|
| + NormalTestDisplayItem(const DisplayItemClient& client)
|
| + : TestDisplayItem(client, DisplayItem::kDrawingFirst) {}
|
| };
|
|
|
| class TestDisplayItemRequiringSeparateChunk : public TestDisplayItem {
|
| public:
|
| - TestDisplayItemRequiringSeparateChunk()
|
| - : TestDisplayItem(DisplayItem::kForeignLayerPlugin) {}
|
| + TestDisplayItemRequiringSeparateChunk(const DisplayItemClient& client)
|
| + : TestDisplayItem(client, DisplayItem::kForeignLayerPlugin) {}
|
| };
|
|
|
| TEST_F(PaintChunkerTest, Empty) {
|
| @@ -72,8 +74,8 @@ TEST_F(PaintChunkerTest, SingleNonEmptyRange) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(PaintChunk(0, 2, nullptr,
|
| @@ -84,11 +86,11 @@ TEST_F(PaintChunkerTest, SamePropertiesTwiceCombineIntoOneChunk) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(PaintChunk(0, 3, nullptr,
|
| @@ -99,10 +101,10 @@ TEST_F(PaintChunkerTest, CanRewindDisplayItemIndex) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.decrementDisplayItemIndex();
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(PaintChunk(0, 2, nullptr,
|
| @@ -113,21 +115,21 @@ TEST_F(PaintChunkerTest, BuildMultipleChunksWithSinglePropertyChanging) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransform = rootPaintChunkProperties();
|
| simpleTransform.transform = TransformPaintPropertyNode::create(
|
| nullptr, TransformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransform);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties anotherTransform = rootPaintChunkProperties();
|
| anotherTransform.transform = TransformPaintPropertyNode::create(
|
| nullptr, TransformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
|
| chunker.updateCurrentPaintChunkProperties(nullptr, anotherTransform);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| @@ -141,14 +143,14 @@ TEST_F(PaintChunkerTest, BuildMultipleChunksWithDifferentPropertyChanges) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransform = rootPaintChunkProperties();
|
| simpleTransform.transform = TransformPaintPropertyNode::create(
|
| nullptr, TransformationMatrix(0, 0, 0, 0, 0, 0), FloatPoint3D(9, 8, 7));
|
| chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransform);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransformAndEffect = rootPaintChunkProperties();
|
| simpleTransformAndEffect.transform = simpleTransform.transform;
|
| @@ -156,8 +158,8 @@ TEST_F(PaintChunkerTest, BuildMultipleChunksWithDifferentPropertyChanges) {
|
| EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
|
| ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5f);
|
| chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransformAndEffect);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransformAndEffectWithUpdatedTransform =
|
| rootPaintChunkProperties();
|
| @@ -172,14 +174,14 @@ TEST_F(PaintChunkerTest, BuildMultipleChunksWithDifferentPropertyChanges) {
|
| simpleTransformAndEffect.effect->opacity());
|
| chunker.updateCurrentPaintChunkProperties(
|
| nullptr, simpleTransformAndEffectWithUpdatedTransform);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| // Test that going back to a previous chunk property still creates a new
|
| // chunk.
|
| chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransformAndEffect);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| @@ -201,18 +203,18 @@ TEST_F(PaintChunkerTest, BuildChunksFromNestedTransforms) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransform = rootPaintChunkProperties();
|
| simpleTransform.transform = TransformPaintPropertyNode::create(
|
| nullptr, TransformationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
|
| chunker.updateCurrentPaintChunkProperties(nullptr, simpleTransform);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| @@ -228,7 +230,7 @@ TEST_F(PaintChunkerTest, ChangingPropertiesWithoutItems) {
|
| PaintChunker chunker;
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties firstTransform = rootPaintChunkProperties();
|
| firstTransform.transform = TransformPaintPropertyNode::create(
|
| @@ -240,7 +242,7 @@ TEST_F(PaintChunkerTest, ChangingPropertiesWithoutItems) {
|
| nullptr, TransformationMatrix(9, 8, 7, 6, 5, 4), FloatPoint3D(3, 2, 1));
|
| chunker.updateCurrentPaintChunkProperties(nullptr, secondTransform);
|
|
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks,
|
| @@ -252,21 +254,27 @@ TEST_F(PaintChunkerTest, CreatesSeparateChunksWhenRequested) {
|
| // Tests that the chunker creates a separate chunks for display items which
|
| // require it.
|
| PaintChunker chunker;
|
| - TestDisplayItemRequiringSeparateChunk i1, i2, i3, i4, i5, i6;
|
| + TestDisplayItemRequiringSeparateChunk i1(m_client);
|
| + TestDisplayItemRequiringSeparateChunk i2(m_client);
|
| + TestDisplayItemRequiringSeparateChunk i3(m_client);
|
| + TestDisplayItemRequiringSeparateChunk i4(m_client);
|
| + TestDisplayItemRequiringSeparateChunk i5(m_client);
|
| + TestDisplayItemRequiringSeparateChunk i6(m_client);
|
| +
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.incrementDisplayItemIndex(i1);
|
| chunker.incrementDisplayItemIndex(i2);
|
| chunker.incrementDisplayItemIndex(i3);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.incrementDisplayItemIndex(i4);
|
| chunker.incrementDisplayItemIndex(i5);
|
| chunker.decrementDisplayItemIndex();
|
| chunker.decrementDisplayItemIndex();
|
| chunker.decrementDisplayItemIndex();
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.incrementDisplayItemIndex(i6);
|
|
|
| DisplayItem::Id id1 = i1.getId();
|
| @@ -285,15 +293,15 @@ TEST_F(PaintChunkerTest, CreatesSeparateChunksWhenRequested) {
|
|
|
| TEST_F(PaintChunkerTest, ChunkIds) {
|
| PaintChunker chunker;
|
| - TestDisplayItem i1(DisplayItem::kDrawingFirst);
|
| + TestDisplayItem i1(m_client, DisplayItem::kDrawingFirst);
|
| DisplayItem::Id id1 = i1.getId();
|
| - TestDisplayItemRequiringSeparateChunk i2;
|
| + TestDisplayItemRequiringSeparateChunk i2(m_client);
|
| DisplayItem::Id id2 = i2.getId();
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransform = rootPaintChunkProperties();
|
| simpleTransform.transform = TransformPaintPropertyNode::create(
|
| @@ -301,13 +309,13 @@ TEST_F(PaintChunkerTest, ChunkIds) {
|
| chunker.updateCurrentPaintChunkProperties(&id1, simpleTransform);
|
|
|
| chunker.incrementDisplayItemIndex(i1);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.incrementDisplayItemIndex(i2);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
| EXPECT_THAT(
|
| @@ -321,16 +329,16 @@ TEST_F(PaintChunkerTest, ChunkIds) {
|
|
|
| TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) {
|
| PaintChunker chunker;
|
| - TestDisplayItem i1(DisplayItem::kDrawingFirst);
|
| + TestDisplayItem i1(m_client, DisplayItem::kDrawingFirst);
|
| i1.setSkippedCache();
|
| DisplayItem::Id id1 = i1.getId();
|
| - TestDisplayItemRequiringSeparateChunk i2;
|
| + TestDisplayItemRequiringSeparateChunk i2(m_client);
|
| i2.setSkippedCache();
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| PaintChunkProperties simpleTransform = rootPaintChunkProperties();
|
| simpleTransform.transform = TransformPaintPropertyNode::create(
|
| @@ -338,13 +346,13 @@ TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) {
|
| chunker.updateCurrentPaintChunkProperties(&id1, simpleTransform);
|
|
|
| chunker.incrementDisplayItemIndex(i1);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
| chunker.incrementDisplayItemIndex(i2);
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| chunker.updateCurrentPaintChunkProperties(nullptr,
|
| rootPaintChunkProperties());
|
| - chunker.incrementDisplayItemIndex(NormalTestDisplayItem());
|
| + chunker.incrementDisplayItemIndex(NormalTestDisplayItem(m_client));
|
|
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
| EXPECT_THAT(
|
| @@ -356,7 +364,5 @@ TEST_F(PaintChunkerTest, ChunkIdsSkippingCache) {
|
| PaintChunk(6, 7, nullptr, rootPaintChunkProperties())));
|
| }
|
|
|
| -#endif
|
| -
|
| } // namespace
|
| } // namespace blink
|
|
|