| 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 "platform/wtf/Optional.h" | 9 #include "platform/wtf/Optional.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 EXPECT_TRUE(PaintChunk(0, 1, &id, properties) | 29 EXPECT_TRUE(PaintChunk(0, 1, &id, properties) |
| 30 .matches(PaintChunk(0, 1, &idEqual, properties))); | 30 .matches(PaintChunk(0, 1, &idEqual, properties))); |
| 31 EXPECT_TRUE(PaintChunk(0, 1, &idEqual, properties) | 31 EXPECT_TRUE(PaintChunk(0, 1, &idEqual, properties) |
| 32 .matches(PaintChunk(0, 1, &id, properties))); | 32 .matches(PaintChunk(0, 1, &id, properties))); |
| 33 } | 33 } |
| 34 | 34 |
| 35 TEST(PaintChunkTest, IdNotMatches) { | 35 TEST(PaintChunkTest, IdNotMatches) { |
| 36 PaintChunkProperties properties; | 36 PaintChunkProperties properties; |
| 37 FakeDisplayItemClient client1; | 37 FakeDisplayItemClient client1; |
| 38 client1.updateCacheGeneration(); | 38 client1.updateCacheGeneration(); |
| 39 DisplayItem::Id id1(client1, DisplayItem::kDrawingFirst); | 39 DisplayItem::Id id1a(client1, DisplayItem::kDrawingFirst); |
| 40 DisplayItem::Id id1b(client1, DisplayItem::kSubsequence); |
| 41 EXPECT_FALSE(PaintChunk(0, 1, &id1a, properties) |
| 42 .matches(PaintChunk(0, 1, &id1b, properties))); |
| 43 EXPECT_FALSE(PaintChunk(0, 1, &id1b, properties) |
| 44 .matches(PaintChunk(0, 1, &id1a, properties))); |
| 40 | 45 |
| 41 FakeDisplayItemClient client2; | 46 FakeDisplayItemClient client2; |
| 42 client2.updateCacheGeneration(); | 47 client2.updateCacheGeneration(); |
| 43 DisplayItem::Id id2(client2, DisplayItem::kDrawingFirst); | 48 DisplayItem::Id id2(client2, DisplayItem::kDrawingFirst); |
| 49 EXPECT_FALSE(PaintChunk(0, 1, &id1a, properties) |
| 50 .matches(PaintChunk(0, 1, &id2, properties))); |
| 44 EXPECT_FALSE(PaintChunk(0, 1, &id2, properties) | 51 EXPECT_FALSE(PaintChunk(0, 1, &id2, properties) |
| 45 .matches(PaintChunk(0, 1, &id1, properties))); | 52 .matches(PaintChunk(0, 1, &id1a, properties))); |
| 46 } | 53 } |
| 47 | 54 |
| 48 TEST(PaintChunkTest, IdNotMatchesNull) { | 55 TEST(PaintChunkTest, IdNotMatchesNull) { |
| 49 PaintChunkProperties properties; | 56 PaintChunkProperties properties; |
| 50 FakeDisplayItemClient client; | 57 FakeDisplayItemClient client; |
| 51 client.updateCacheGeneration(); | 58 client.updateCacheGeneration(); |
| 52 DisplayItem::Id id(client, DisplayItem::kDrawingFirst); | 59 DisplayItem::Id id(client, DisplayItem::kDrawingFirst); |
| 53 EXPECT_FALSE(PaintChunk(0, 1, nullptr, properties) | 60 EXPECT_FALSE(PaintChunk(0, 1, nullptr, properties) |
| 54 .matches(PaintChunk(0, 1, &id, properties))); | 61 .matches(PaintChunk(0, 1, &id, properties))); |
| 55 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 62 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 | 86 |
| 80 // 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. |
| 81 client = WTF::nullopt; | 88 client = WTF::nullopt; |
| 82 client.emplace(); | 89 client.emplace(); |
| 83 EXPECT_TRUE(client->isJustCreated()); | 90 EXPECT_TRUE(client->isJustCreated()); |
| 84 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 91 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
| 85 .matches(PaintChunk(0, 1, &id, properties))); | 92 .matches(PaintChunk(0, 1, &id, properties))); |
| 86 } | 93 } |
| 87 | 94 |
| 88 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |