chromium/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_CONTROLLER_TEST_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_CONTROLLER_TEST_H_

#include "base/auto_reset.h"
#include "base/dcheck_is_on.h"
#include "base/functional/function_ref.h"
#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/heap/persistent.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"

namespace blink {

class GraphicsContext;

class PaintControllerForTest : public PaintController {};

class AutoCommitPaintController : public PaintControllerForTest {};

class PaintControllerTestBase : public testing::Test {};

// Matcher for checking display item list. Sample usage:
// EXPECT_THAT(paint_controller.GetDisplayItemList(),
//             ElementsAre(IsSameId(client1, kBackgroundType),
//                         IsSameId(client2, kForegroundType)));
MATCHER_P(IsSameId, id, "") {}
MATCHER_P2(IsSameId, client_id, type, "") {}
MATCHER_P3(IsSameId, client_id, type, fragment, "") {}

// Matcher for checking paint chunks. Sample usage:
// EXPACT_THAT(paint_controller.GetPaintChunks(),
//             ELementsAre(IsPaintChunk(0, 1, id1, properties1),
//                         IsPaintChunk(1, 3, id2, properties2)));
inline bool CheckChunk(const PaintChunk& chunk,
                       wtf_size_t begin,
                       wtf_size_t end) {}
inline bool CheckChunk(const PaintChunk& chunk,
                       wtf_size_t begin,
                       wtf_size_t end,
                       const PaintChunk::Id& id,
                       const PropertyTreeStateOrAlias& properties,
                       const HitTestData* hit_test_data = nullptr,
                       const gfx::Rect* bounds = nullptr) {}
MATCHER_P2(IsPaintChunk, begin, end, "") {}
MATCHER_P4(IsPaintChunk, begin, end, id, properties, "") {}
MATCHER_P5(IsPaintChunk, begin, end, id, properties, hit_test_data, "") {}
MATCHER_P6(IsPaintChunk,
           begin,
           end,
           id,
           properties,
           hit_test_data,
           bounds,
           "") {}

// Shorter names for frequently used display item types in tests.
const DisplayItem::Type kBackgroundType =;
const DisplayItem::Type kForegroundType =;
const DisplayItem::Type kClipType =;

#define EXPECT_SUBSEQUENCE(client, expected_start_chunk_index,     \
                           expected_end_chunk_index)

#define EXPECT_SUBSEQUENCE_FROM_CHUNK(client, start_chunk_iterator, \
                                      chunk_count)

#define EXPECT_NO_SUBSEQUENCE(client)

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_PAINT_CONTROLLER_TEST_H_