summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h')
-rw-r--r--chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h58
1 files changed, 46 insertions, 12 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h b/chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
index 11f903de4e0..3f1b1142cce 100644
--- a/chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
+++ b/chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
@@ -8,6 +8,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
+#include "third_party/blink/renderer/platform/graphics/paint/hit_test_data.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
#include "third_party/blink/renderer/platform/testing/fake_display_item_client.h"
#include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h"
@@ -47,7 +48,7 @@ class PaintControllerTestBase : public testing::Test {
void InitRootChunk() { InitRootChunk(GetPaintController()); }
void InitRootChunk(PaintController& paint_controller) {
paint_controller.UpdateCurrentPaintChunkProperties(
- root_paint_chunk_id_, DefaultPaintChunkProperties());
+ &root_paint_chunk_id_, DefaultPaintChunkProperties());
}
const PaintChunk::Id DefaultRootChunkId() const {
return root_paint_chunk_id_;
@@ -55,20 +56,20 @@ class PaintControllerTestBase : public testing::Test {
PaintController& GetPaintController() { return *paint_controller_; }
- size_t NumCachedNewItems() const {
+ wtf_size_t NumCachedNewItems() const {
return paint_controller_->num_cached_new_items_;
}
- size_t NumCachedNewSubsequences() const {
+ wtf_size_t NumCachedNewSubsequences() const {
return paint_controller_->num_cached_new_subsequences_;
}
#if DCHECK_IS_ON()
- size_t NumIndexedItems() const {
+ wtf_size_t NumIndexedItems() const {
return paint_controller_->num_indexed_items_;
}
- size_t NumSequentialMatches() const {
+ wtf_size_t NumSequentialMatches() const {
return paint_controller_->num_sequential_matches_;
}
- size_t NumOutOfOrderMatches() const {
+ wtf_size_t NumOutOfOrderMatches() const {
return paint_controller_->num_out_of_order_matches_;
}
#endif
@@ -116,22 +117,42 @@ MATCHER_P2(IsSameId, client, type, "") {
// ELementsAre(IsPaintChunk(0, 1, id1, properties1),
// IsPaintChunk(1, 3, id2, properties2)));
inline bool CheckChunk(const PaintChunk& chunk,
- size_t begin,
- size_t end,
+ wtf_size_t begin,
+ wtf_size_t end) {
+ return chunk.begin_index == begin && chunk.end_index == end;
+}
+inline bool CheckChunk(const PaintChunk& chunk,
+ wtf_size_t begin,
+ wtf_size_t end,
const PaintChunk::Id& id,
const PropertyTreeState& properties,
- const HitTestData* hit_test_data = nullptr) {
+ const HitTestData* hit_test_data = nullptr,
+ const IntRect* bounds = nullptr) {
return chunk.begin_index == begin && chunk.end_index == end &&
chunk.id == id && chunk.properties == properties &&
((!chunk.hit_test_data && !hit_test_data) ||
(chunk.hit_test_data && hit_test_data &&
- *chunk.hit_test_data == *hit_test_data));
+ *chunk.hit_test_data == *hit_test_data)) &&
+ (!bounds || chunk.bounds == *bounds);
+}
+MATCHER_P2(IsPaintChunk, begin, end, "") {
+ return CheckChunk(arg, begin, end);
}
MATCHER_P4(IsPaintChunk, begin, end, id, properties, "") {
return CheckChunk(arg, begin, end, id, properties);
}
MATCHER_P5(IsPaintChunk, begin, end, id, properties, hit_test_data, "") {
- return CheckChunk(arg, begin, end, id, properties, &hit_test_data);
+ return CheckChunk(arg, begin, end, id, properties, hit_test_data);
+}
+MATCHER_P6(IsPaintChunk,
+ begin,
+ end,
+ id,
+ properties,
+ hit_test_data,
+ bounds,
+ "") {
+ return CheckChunk(arg, begin, end, id, properties, hit_test_data, &bounds);
}
// Shorter names for frequently used display item types in tests.
@@ -140,9 +161,22 @@ const DisplayItem::Type kForegroundType =
static_cast<DisplayItem::Type>(DisplayItem::kDrawingPaintPhaseFirst + 5);
const DisplayItem::Type kDocumentBackgroundType =
DisplayItem::kDocumentBackground;
-const DisplayItem::Type kScrollHitTestType = DisplayItem::kScrollHitTest;
const DisplayItem::Type kClipType = DisplayItem::kClipPaintPhaseFirst;
+#define EXPECT_SUBSEQUENCE(client, expected_start_chunk_index, \
+ expected_end_chunk_index) \
+ do { \
+ auto* subsequence = GetSubsequenceMarkers(client); \
+ ASSERT_NE(nullptr, subsequence); \
+ EXPECT_EQ(static_cast<wtf_size_t>(expected_start_chunk_index), \
+ subsequence->start_chunk_index); \
+ EXPECT_EQ(static_cast<wtf_size_t>(expected_end_chunk_index), \
+ subsequence->end_chunk_index); \
+ } while (false)
+
+#define EXPECT_NO_SUBSEQUENCE(client) \
+ EXPECT_EQ(nullptr, GetSubsequenceMarkers(client))
+
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_CONTROLLER_TEST_H_