#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier_delegate.h"
#include <memory>
#include <optional>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "chrome/test/base/chrome_unit_test_suite.h"
#include "components/safe_browsing/content/common/safe_browsing.mojom-shared.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/features.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/scorer.h"
#include "components/safe_browsing/core/common/fbs/client_model_generated.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "content/public/renderer/render_frame.h"
#include "mojo/public/cpp/base/proto_wrapper.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "url/gurl.h"
ASCIIToUTF16;
_;
Eq;
InSequence;
Mock;
Pointee;
Property;
StrictMock;
namespace safe_browsing {
namespace {
scoped_refptr<const base::RefCountedString16> MakeRefPtrString(
const std::u16string& str) { … }
testing::Matcher<scoped_refptr<const base::RefCountedString16>>
RefCntStr16Matcher(const scoped_refptr<const base::RefCountedString16>& str) { … }
std::string GetFlatBufferString(int version) { … }
class MockPhishingClassifier : public PhishingClassifier { … };
}
class PhishingClassifierDelegateTest : public ChromeRenderViewTest { … };
TEST_F(PhishingClassifierDelegateTest, Navigation) { … }
TEST_F(PhishingClassifierDelegateTest, NoPhishingModel) { … }
TEST_F(PhishingClassifierDelegateTest, HasFlatBufferModel) { … }
TEST_F(PhishingClassifierDelegateTest, HasVisualTfLiteModel) { … }
TEST_F(PhishingClassifierDelegateTest, NoScorerWithRetry) { … }
TEST_F(PhishingClassifierDelegateTest, NoScorer_Ref_WithRetry) { … }
TEST_F(PhishingClassifierDelegateTest, NoScorer) { … }
TEST_F(PhishingClassifierDelegateTest, NoScorer_Ref) { … }
TEST_F(PhishingClassifierDelegateTest, NoScorerWithinTimeout) { … }
TEST_F(PhishingClassifierDelegateTest, NoStartPhishingDetection) { … }
TEST_F(PhishingClassifierDelegateTest, IgnorePreliminaryCapture) { … }
TEST_F(PhishingClassifierDelegateTest, DuplicatePageCapture) { … }
TEST_F(PhishingClassifierDelegateTest, PhishingDetectionDone) { … }
}