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 id1a(client1, DisplayItem::kDrawingFirst); | 39 DisplayItem::Id id1(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))); | |
45 | 40 |
46 FakeDisplayItemClient client2; | 41 FakeDisplayItemClient client2; |
47 client2.updateCacheGeneration(); | 42 client2.updateCacheGeneration(); |
48 DisplayItem::Id id2(client2, DisplayItem::kDrawingFirst); | 43 DisplayItem::Id id2(client2, DisplayItem::kDrawingFirst); |
49 EXPECT_FALSE(PaintChunk(0, 1, &id1a, properties) | |
50 .matches(PaintChunk(0, 1, &id2, properties))); | |
51 EXPECT_FALSE(PaintChunk(0, 1, &id2, properties) | 44 EXPECT_FALSE(PaintChunk(0, 1, &id2, properties) |
52 .matches(PaintChunk(0, 1, &id1a, properties))); | 45 .matches(PaintChunk(0, 1, &id1, properties))); |
53 } | 46 } |
54 | 47 |
55 TEST(PaintChunkTest, IdNotMatchesNull) { | 48 TEST(PaintChunkTest, IdNotMatchesNull) { |
56 PaintChunkProperties properties; | 49 PaintChunkProperties properties; |
57 FakeDisplayItemClient client; | 50 FakeDisplayItemClient client; |
58 client.updateCacheGeneration(); | 51 client.updateCacheGeneration(); |
59 DisplayItem::Id id(client, DisplayItem::kDrawingFirst); | 52 DisplayItem::Id id(client, DisplayItem::kDrawingFirst); |
60 EXPECT_FALSE(PaintChunk(0, 1, nullptr, properties) | 53 EXPECT_FALSE(PaintChunk(0, 1, nullptr, properties) |
61 .matches(PaintChunk(0, 1, &id, properties))); | 54 .matches(PaintChunk(0, 1, &id, properties))); |
62 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 55 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
(...skipping 23 matching lines...) Expand all Loading... |
86 | 79 |
87 // Delete the current object and create a new object at the same address. | 80 // Delete the current object and create a new object at the same address. |
88 client = WTF::nullopt; | 81 client = WTF::nullopt; |
89 client.emplace(); | 82 client.emplace(); |
90 EXPECT_TRUE(client->isJustCreated()); | 83 EXPECT_TRUE(client->isJustCreated()); |
91 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) | 84 EXPECT_FALSE(PaintChunk(0, 1, &id, properties) |
92 .matches(PaintChunk(0, 1, &id, properties))); | 85 .matches(PaintChunk(0, 1, &id, properties))); |
93 } | 86 } |
94 | 87 |
95 } // namespace blink | 88 } // namespace blink |
OLD | NEW |