#include "content/public/test/find_test_utils.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "content/browser/find_request_manager.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
const int kInvalidId = …;
}
FindResults::FindResults(int request_id,
int number_of_matches,
int active_match_ordinal)
: … { … }
FindResults::FindResults() : … { … }
FindTestWebContentsDelegate::FindTestWebContentsDelegate()
: … { … }
FindTestWebContentsDelegate::~FindTestWebContentsDelegate() { … }
const FindResults& FindTestWebContentsDelegate::GetFindResults() const { … }
void FindTestWebContentsDelegate::WaitForFinalReply() { … }
void FindTestWebContentsDelegate::WaitForNextReply() { … }
void FindTestWebContentsDelegate::MarkNextReply() { … }
void FindTestWebContentsDelegate::UpdateLastRequest(int request_id) { … }
void FindTestWebContentsDelegate::StartReplyRecord() { … }
const std::vector<FindResults>& FindTestWebContentsDelegate::GetReplyRecord() { … }
#if BUILDFLAG(IS_ANDROID)
void FindTestWebContentsDelegate::WaitForMatchRects() {
WaitFor(MATCH_RECTS);
}
#endif
void FindTestWebContentsDelegate::FindReply(WebContents* web_contents,
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) { … }
bool FindTestWebContentsDelegate::IsBackForwardCacheSupported(
WebContents& web_contents) { … }
void FindTestWebContentsDelegate::WaitFor(WaitingFor wait_for) { … }
void FindTestWebContentsDelegate::StopWaiting() { … }
#if BUILDFLAG(IS_ANDROID)
void FindTestWebContentsDelegate::FindMatchRectsReply(
WebContents* web_contents,
int version,
const std::vector<gfx::RectF>& rects,
const gfx::RectF& active_rect) {
find_match_rects_ = rects;
active_match_rect_ = active_rect;
if (waiting_for_ == MATCH_RECTS)
StopWaiting();
}
#endif
std::unordered_set<raw_ptr<RenderFrameHost, CtnExperimental>>
GetRenderFrameHostsWithPendingFindResults(WebContents* web_contents) { … }
}