chromium/components/subresource_filter/content/shared/browser/child_frame_navigation_test_utils.h

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

#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_SHARED_BROWSER_CHILD_FRAME_NAVIGATION_TEST_UTILS_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_SHARED_BROWSER_CHILD_FRAME_NAVIGATION_TEST_UTILS_H_

#include <memory>
#include <sstream>
#include <string>
#include <string_view>

#include "components/subresource_filter/core/browser/async_document_subresource_filter.h"
#include "components/subresource_filter/core/common/test_ruleset_creator.h"
#include "components/subresource_filter/core/mojom/subresource_filter.mojom.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "net/base/net_errors.h"
#include "url/gurl.h"

namespace content {
class NavigationSimulator;
}

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);

// Harness class that implements most functionality needed to test different
// implementations of ChildFrameNavigationFilteringThrottle and can be reused
// for unittests.
class ChildFrameNavigationFilteringThrottleTestHarness
    : public content::RenderViewHostTestHarness,
      public content::WebContentsObserver {};

}  // namespace subresource_filter

#endif  // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_SHARED_BROWSER_CHILD_FRAME_NAVIGATION_TEST_UTILS_H_