#include "ui/views/test/view_skia_gold_pixel_diff.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
#include "ui/base/test/skia_gold_matching_algorithm.h"
#include "ui/base/test/skia_gold_pixel_diff.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/image.h"
#include "ui/snapshot/snapshot.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
#include "ui/snapshot/snapshot_aura.h"
#endif
namespace views {
namespace {
void SnapshotCallback(base::RunLoop* run_loop,
gfx::Image* ret_image,
gfx::Image image) { … }
}
ViewSkiaGoldPixelDiff::ViewSkiaGoldPixelDiff(
const std::string& screenshot_prefix,
const std::optional<std::string>& corpus)
: … { … }
ViewSkiaGoldPixelDiff::~ViewSkiaGoldPixelDiff() = default;
bool ViewSkiaGoldPixelDiff::CompareViewScreenshot(
const std::string& screenshot_name,
const views::View* view,
const ui::test::SkiaGoldMatchingAlgorithm* algorithm) const { … }
bool ViewSkiaGoldPixelDiff::CompareNativeWindowScreenshot(
const std::string& screenshot_name,
gfx::NativeWindow window,
const gfx::Rect& snapshot_bounds,
const ui::test::SkiaGoldMatchingAlgorithm* algorithm) const { … }
bool ViewSkiaGoldPixelDiff::CompareNativeWindowScreenshotInRects(
const std::string& screenshot_name,
gfx::NativeWindow window,
const gfx::Rect& snapshot_bounds,
const ui::test::SkiaGoldMatchingAlgorithm* algorithm,
const std::vector<gfx::Rect>& regions_of_interest) const { … }
bool ViewSkiaGoldPixelDiff::GrabWindowSnapshotInternal(
gfx::NativeWindow window,
const gfx::Rect& snapshot_bounds,
gfx::Image* image) const { … }
void ViewSkiaGoldPixelDiff::KeepPixelsInRects(
const std::vector<gfx::Rect>& rects,
gfx::Image* image) const { … }
}