chromium/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc

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

#include "components/safe_browsing/content/renderer/phishing_classifier/phishing_dom_feature_extractor.h"

#include <memory>
#include <string_view>
#include <unordered_map>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/escape.h"
#include "base/time/time.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/features.h"
#include "components/safe_browsing/content/renderer/phishing_classifier/test_utils.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/test/test_utils.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/platform/url_conversion.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_frame.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "ui/native_theme/native_theme_features.h"

WebRuntimeFeatures;
DoAll;
Invoke;
Return;
StrictMock;

namespace safe_browsing {

class MockTickClock : public base::TickClock {};

// TestPhishingDOMFeatureExtractor has nearly identical behavior as
// PhishingDOMFeatureExtractor, except the IsExternalDomain() and
// CompleteURL() functions. This is to work around the fact that
// ChromeRenderViewTest object does not know where the html content is hosted.
class TestPhishingDOMFeatureExtractor : public PhishingDOMFeatureExtractor {};

class TestChromeContentRendererClient : public ChromeContentRendererClient {};

class PhishingDOMFeatureExtractorTest : public ChromeRenderViewTest {};

TEST_F(PhishingDOMFeatureExtractorTest, FormFeatures) {}

TEST_F(PhishingDOMFeatureExtractorTest, LinkFeatures) {}

TEST_F(PhishingDOMFeatureExtractorTest, ScriptAndImageFeatures) {}

// A page with nested iframes.
//         html
// iframe2 /  \ iframe1
//              \ iframe3
TEST_F(PhishingDOMFeatureExtractorTest, SubFrames) {}

TEST_F(PhishingDOMFeatureExtractorTest, Continuation) {}

TEST_F(PhishingDOMFeatureExtractorTest, SubframeRemoval) {}

}  // namespace safe_browsing