#include "components/subresource_filter/content/shared/browser/child_frame_navigation_test_utils.h"
#include <memory>
#include <sstream>
#include <string>
#include <string_view>
#include "base/check.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "components/subresource_filter/content/shared/browser/child_frame_navigation_filtering_throttle.h"
#include "components/subresource_filter/content/shared/browser/child_frame_navigation_test_utils.h"
#include "components/subresource_filter/core/browser/async_document_subresource_filter.h"
#include "components/subresource_filter/core/browser/async_document_subresource_filter_test_utils.h"
#include "components/subresource_filter/core/browser/subresource_filter_constants.h"
#include "components/subresource_filter/core/browser/verified_ruleset_dealer.h"
#include "components/subresource_filter/core/common/constants.h"
#include "components/subresource_filter/core/mojom/subresource_filter.mojom.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace subresource_filter {
content::NavigationThrottle::ThrottleCheckResult SimulateStartAndGetResult(
content::NavigationSimulator* navigation_simulator) { … }
content::NavigationThrottle::ThrottleCheckResult SimulateRedirectAndGetResult(
content::NavigationSimulator* navigation_simulator,
const GURL& new_url) { … }
content::NavigationThrottle::ThrottleCheckResult SimulateCommitAndGetResult(
content::NavigationSimulator* navigation_simulator) { … }
void SimulateFailedNavigation(
content::NavigationSimulator* navigation_simulator,
net::Error error) { … }
ChildFrameNavigationFilteringThrottleTestHarness::
ChildFrameNavigationFilteringThrottleTestHarness() = default;
ChildFrameNavigationFilteringThrottleTestHarness::
~ChildFrameNavigationFilteringThrottleTestHarness() = default;
void ChildFrameNavigationFilteringThrottleTestHarness::SetUp() { … }
void ChildFrameNavigationFilteringThrottleTestHarness::TearDown() { … }
std::string
ChildFrameNavigationFilteringThrottleTestHarness::GetFilterConsoleMessage(
const GURL& filtered_url) { … }
void ChildFrameNavigationFilteringThrottleTestHarness::
InitializeDocumentSubresourceFilter(const GURL& document_url,
mojom::ActivationLevel parent_level) { … }
void ChildFrameNavigationFilteringThrottleTestHarness::
InitializeDocumentSubresourceFilterWithSubstringRules(
const GURL& document_url,
std::vector<std::string_view> urls_to_block,
mojom::ActivationLevel parent_level) { … }
void ChildFrameNavigationFilteringThrottleTestHarness::RunUntilIdle() { … }
void ChildFrameNavigationFilteringThrottleTestHarness::
CreateTestSubframeAndInitNavigation(const GURL& first_url,
content::RenderFrameHost* parent) { … }
const std::vector<std::string>&
ChildFrameNavigationFilteringThrottleTestHarness::GetConsoleMessages() { … }
void ChildFrameNavigationFilteringThrottleTestHarness::
SetResponseDnsAliasesForNavigation(std::vector<std::string> aliases) { … }
void ChildFrameNavigationFilteringThrottleTestHarness::
FinishInitializingDocumentSubresourceFilter(
const GURL& document_url,
mojom::ActivationLevel parent_level) { … }
}