| 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/paint/PaintChunk.h" | 5 #include "platform/graphics/paint/PaintChunk.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/testing/FakeDisplayItemClient.h" | 8 #include "platform/testing/FakeDisplayItemClient.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/Optional.h" | 10 #include "wtf/Optional.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 TEST(PaintChunkTest, IdNotMatchesJustCreated) { | 68 TEST(PaintChunkTest, IdNotMatchesJustCreated) { |
| 69 PaintChunkProperties properties; | 69 PaintChunkProperties properties; |
| 70 Optional<FakeDisplayItemClient> client; | 70 Optional<FakeDisplayItemClient> client; |
| 71 client.emplace(); | 71 client.emplace(); |
| 72 EXPECT_TRUE(client->isJustCreated()); | 72 EXPECT_TRUE(client->isJustCreated()); |
| 73 // Invalidation won't change the "just created" status. | 73 // Invalidation won't change the "just created" status. |
| 74 client->setDisplayItemsUncached(); | 74 client->setDisplayItemsUncached(); |
| 75 EXPECT_TRUE(client->isJustCreated()); | 75 EXPECT_TRUE(client->isJustCreated()); |
| 76 | 76 |
| 77 DisplayItem::Id id(*client, DisplayItem::kDrawingFirst); | 77 DisplayItem::Id id(*client, DisplayItem::kDrawingFirst); |
| 78 // A chunk of a newly created client doesn't match any chunk because it's neve
r cached. | 78 // A chunk of a newly created client doesn't match any chunk because it's |
| 79 // never cached. |
| 79 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 80 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
| 80 .matches(PaintChunk(0, 1, &id, properties))); | 81 .matches(PaintChunk(0, 1, &id, properties))); |
| 81 | 82 |
| 82 client->updateCacheGeneration(); | 83 client->updateCacheGeneration(); |
| 83 EXPECT_TRUE(PaintChunk(0, 1, &id, properties) | 84 EXPECT_TRUE(PaintChunk(0, 1, &id, properties) |
| 84 .matches(PaintChunk(0, 1, &id, properties))); | 85 .matches(PaintChunk(0, 1, &id, properties))); |
| 85 | 86 |
| 86 // Delete the current object and create a new object at the same address. | 87 // Delete the current object and create a new object at the same address. |
| 87 client = WTF::nullopt; | 88 client = WTF::nullopt; |
| 88 client.emplace(); | 89 client.emplace(); |
| 89 EXPECT_TRUE(client->isJustCreated()); | 90 EXPECT_TRUE(client->isJustCreated()); |
| 90 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 91 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
| 91 .matches(PaintChunk(0, 1, &id, properties))); | 92 .matches(PaintChunk(0, 1, &id, properties))); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |