chromium/content/public/test/browser_test_utils.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.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "content/public/test/browser_test_utils.h"

#include <stddef.h>

#include <cstdint>
#include <set>
#include <string_view>
#include <tuple>
#include <utility>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "base/process/kill.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/pattern.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "base/test/test_switches.h"
#include "base/test/test_timeouts.h"
#include "base/trace_event/typed_macros.h"
#include "base/types/optional_util.h"
#include "base/uuid.h"
#include "base/values.h"
#include "build/build_config.h"
#include "cc/test/pixel_test_utils.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/viz/client/frame_evictor.h"
#include "content/browser/file_system/file_system_manager_impl.h"
#include "content/browser/file_system_access/file_system_access_manager_impl.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_frame_metadata_provider_impl.h"
#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "content/common/frame.mojom.h"
#include "content/common/input/synthetic_touchscreen_pinch_gesture.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_termination_info.h"
#include "content/public/browser/histogram_fetcher.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/test/accessibility_notification_waiter.h"
#include "content/public/test/no_renderer_crashes_assertion.h"
#include "content/public/test/simple_url_loader_test_helper.h"
#include "content/public/test/synchronize_visual_properties_interceptor.h"
#include "content/public/test/test_fileapi_operation_waiter.h"
#include "content/public/test/test_frame_navigation_observer.h"
#include "content/public/test/test_launcher.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/test/did_commit_navigation_interceptor.h"
#include "content/test/mock_commit_deferring_condition.h"
#include "ipc/ipc_security_test_util.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/completion_once_callback.h"
#include "net/base/filename_util.h"
#include "net/base/io_buffer.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_util.h"
#include "net/filter/gzip_header.h"
#include "net/filter/gzip_source_stream.h"
#include "net/filter/mock_source_stream.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/python_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/public/mojom/network_service_test.mojom.h"
#include "storage/browser/blob/blob_url_registry.h"
#include "storage/browser/file_system/file_system_context.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "third_party/blink/public/common/frame/frame_visual_properties.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/blob/blob_url_store.mojom-test-utils.h"
#include "third_party/blink/public/mojom/filesystem/file_system.mojom.h"
#include "third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom-shared.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/accessibility/platform/browser_accessibility.h"
#include "ui/accessibility/platform/browser_accessibility_manager.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/clipboard/test/test_clipboard.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/test/draw_waiter_for_test.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/latency/latency_info.h"

#if !BUILDFLAG(IS_ANDROID)
#include "content/browser/media/captured_surface_controller.h"
#include "content/public/test/mock_captured_surface_controller.h"
#endif  // !BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/webui/grit/ash_webui_common_resources.h"
#endif

#if BUILDFLAG(IS_WIN)
#include <combaseapi.h>
#include <wrl/client.h>

#include "base/win/scoped_safearray.h"
#include "base/win/scoped_variant.h"

#include <uiautomation.h>
#endif

#if defined(USE_AURA)
#include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "ui/aura/test/window_event_dispatcher_test_api.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
#include "ui/events/event.h"
#endif  // USE_AURA

namespace content {
namespace {

void BuildSimpleWebKeyEvent(blink::WebInputEvent::Type type,
                            ui::DomKey key,
                            ui::DomCode code,
                            ui::KeyboardCode key_code,
                            input::NativeWebKeyboardEvent* event) {}

void InjectRawKeyEvent(WebContents* web_contents,
                       blink::WebInputEvent::Type type,
                       ui::DomKey key,
                       ui::DomCode code,
                       ui::KeyboardCode key_code,
                       int modifiers) {}

int SimulateModifierKeysDown(WebContents* web_contents,
                             bool control,
                             bool shift,
                             bool alt,
                             bool command) {}

int SimulateModifierKeysUp(WebContents* web_contents,
                           bool control,
                           bool shift,
                           bool alt,
                           bool command,
                           int modifiers) {}

void SimulateKeyEvent(WebContents* web_contents,
                      ui::DomKey key,
                      ui::DomCode code,
                      ui::KeyboardCode key_code,
                      bool send_char,
                      int modifiers) {}

void SimulateKeyPressImpl(WebContents* web_contents,
                          ui::DomKey key,
                          ui::DomCode code,
                          ui::KeyboardCode key_code,
                          bool control,
                          bool shift,
                          bool alt,
                          bool command,
                          bool send_char) {}

std::unique_ptr<net::test_server::HttpResponse>
CrossSiteRedirectResponseHandler(const net::EmbeddedTestServer* test_server,
                                 const net::test_server::HttpRequest& request) {}

// Helper class used by the TestNavigationManager to pause navigations.
// Note: the throttle should be added to the *end* of the list of throttles,
// so all NavigationThrottles that should be attached observe the
// WillStartRequest callback. RegisterThrottleForTesting has this behavior.
class TestNavigationManagerThrottle : public NavigationThrottle {};

#if BUILDFLAG(IS_CHROMEOS_ASH)
bool HasGzipHeader(const base::RefCountedMemory& maybe_gzipped) {
  net::GZipHeader header;
  net::GZipHeader::Status header_status = net::GZipHeader::INCOMPLETE_HEADER;
  const char* header_end = nullptr;
  while (header_status == net::GZipHeader::INCOMPLETE_HEADER) {
    auto chars = base::as_chars(base::span(maybe_gzipped));
    header_status = header.ReadMore(chars.data(), chars.size(), &header_end);
  }
  return header_status == net::GZipHeader::COMPLETE_HEADER;
}

void AppendGzippedResource(const base::RefCountedMemory& encoded,
                           std::string* to_append) {
  auto source_stream = std::make_unique<net::MockSourceStream>();
  auto encoded_chars = base::as_chars(base::span(encoded));
  source_stream->AddReadResult(encoded_chars.data(), encoded_chars.size(),
                               net::OK, net::MockSourceStream::SYNC);
  // Add an EOF.
  auto end = encoded_chars.last(0u);
  source_stream->AddReadResult(end.data(), end.size(), net::OK,
                               net::MockSourceStream::SYNC);
  std::unique_ptr<net::GzipSourceStream> filter = net::GzipSourceStream::Create(
      std::move(source_stream), net::SourceStream::TYPE_GZIP);
  scoped_refptr<net::IOBufferWithSize> dest_buffer =
      base::MakeRefCounted<net::IOBufferWithSize>(4096);
  while (true) {
    int rv = filter->Read(dest_buffer.get(), dest_buffer->size(),
                          net::CompletionOnceCallback());
    ASSERT_LE(0, rv);
    if (rv <= 0)
      break;
    to_append->append(dest_buffer->data(), rv);
  }
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

// Queries for video input devices on the current system using the getSources
// API.
//
// This does not guarantee that a getUserMedia with video will succeed, as the
// camera could be busy for instance.
//
// Returns has-video-input-device to the test if there is a webcam available,
// no-video-input-devices otherwise.
const char kHasVideoInputDeviceOnSystem[] =;

const char kHasVideoInputDevice[] =;

// Interceptor that replaces params.url with |new_url| and params.origin with
// |new_origin| for any commits to |target_url|.
class CommitOriginInterceptor : public DidCommitNavigationInterceptor {};

// Observer which waits for a visual update in a RenderWidgetHost to meet some
// desired conditions.
class ResizeObserver : public RenderWidgetHostObserver {};

// Observer for RenderFrameProxyHost by setting itself through
// RenderFrameProxyHost::SetObserverForTesting.
class ProxyHostObserver : public RenderFrameProxyHost::TestObserver {};

ProxyHostObserver* GetProxyHostObserver() {}

bool IsRequestCompatibleWithSpeculativeRFH(NavigationRequest* request) {}

}  // namespace

bool WaiterHelper::WaitInternal() {}

bool WaiterHelper::Wait() {}

void WaiterHelper::OnEvent() {}

bool NavigateToURL(WebContents* web_contents, const GURL& url) {}

bool NavigateToURL(WebContents* web_contents,
                   const GURL& url,
                   const GURL& expected_commit_url) {}

bool NavigateToURLFromRenderer(const ToRenderFrameHost& adapter,
                               const GURL& url) {}

bool NavigateToURLFromRenderer(const ToRenderFrameHost& adapter,
                               const GURL& url,
                               const GURL& expected_commit_url) {}

bool NavigateToURLFromRendererWithoutUserGesture(
    const ToRenderFrameHost& adapter,
    const GURL& url) {}

bool NavigateToURLFromRendererWithoutUserGesture(
    const ToRenderFrameHost& adapter,
    const GURL& url,
    const GURL& expected_commit_url) {}

bool BeginNavigateToURLFromRenderer(const ToRenderFrameHost& adapter,
                                    const GURL& url) {}

bool NavigateIframeToURL(WebContents* web_contents,
                         std::string_view iframe_id,
                         const GURL& url) {}

bool BeginNavigateIframeToURL(WebContents* web_contents,
                              std::string_view iframe_id,
                              const GURL& url) {}

void NavigateToURLBlockUntilNavigationsComplete(
    WebContents* web_contents,
    const GURL& url,
    int number_of_navigations,
    bool ignore_uncommitted_navigations) {}

void NavigateToURLBlockUntilNavigationsComplete(
    WebContents* web_contents,
    const NavigationController::LoadURLParams& params,
    int number_of_navigations,
    bool ignore_uncommitted_navigations) {}

GURL GetFileUrlWithQuery(const base::FilePath& path,
                         std::string_view query_string) {}

void ResetTouchAction(RenderWidgetHost* host) {}

void RunUntilInputProcessed(RenderWidgetHost* host) {}

std::string ReferrerPolicyToString(
    network::mojom::ReferrerPolicy referrer_policy) {}

mojo::PendingAssociatedReceiver<blink::mojom::FrameWidget>
BindFakeFrameWidgetInterfaces(RenderFrameHost* frame) {}

void SimulateActiveStateForWidget(RenderFrameHost* frame, bool active) {}

std::optional<uint64_t> GetVisitedLinkSaltForNavigation(
    NavigationHandle* navigation_handle) {}

void WaitForLoadStopWithoutSuccessCheck(WebContents* web_contents) {}

bool IsLastCommittedPageNormal(WebContents* web_contents) {}

bool WaitForLoadStop(WebContents* web_contents) {}

bool WaitForNavigationFinished(WebContents* web_contents,
                               TestNavigationObserver& observer) {}

void PrepContentsForBeforeUnloadTest(WebContents* web_contents,
                                     bool trigger_user_activation) {}

bool IsLastCommittedEntryOfPageType(WebContents* web_contents,
                                    content::PageType page_type) {}

void OverrideLastCommittedOrigin(RenderFrameHost* render_frame_host,
                                 const url::Origin& origin) {}

void CrashTab(WebContents* web_contents) {}

void PwnCommitIPC(WebContents* web_contents,
                  const GURL& target_url,
                  const GURL& new_url,
                  const url::Origin& new_origin) {}

bool CanCommitURLForTesting(int child_id, const GURL& url) {}

void SimulateUnresponsiveRenderer(WebContents* web_contents,
                                  RenderWidgetHost* widget) {}

#if defined(USE_AURA)
bool IsResizeComplete(aura::test::WindowEventDispatcherTestApi* dispatcher_test,
                      RenderWidgetHostImpl* widget_host) {}

void WaitForResizeComplete(WebContents* web_contents) {}
#elif BUILDFLAG(IS_ANDROID)
bool IsResizeComplete(RenderWidgetHostImpl* widget_host) {
  return !widget_host->visual_properties_ack_pending_for_testing();
}

void WaitForResizeComplete(WebContents* web_contents) {
  RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
      web_contents->GetRenderViewHost()->GetWidget());
  if (!IsResizeComplete(widget_host)) {
    ResizeObserver resize_observer(
        widget_host, base::BindRepeating(IsResizeComplete, widget_host));
    resize_observer.Wait();
  }
}
#endif

void NotifyCopyableViewInWebContents(WebContents* web_contents,
                                     base::OnceClosure done_callback) {}

void NotifyCopyableViewInFrame(RenderFrameHost* render_frame_host,
                               base::OnceClosure done_callback) {}

void SimulateMouseClick(WebContents* web_contents,
                        int modifiers,
                        blink::WebMouseEvent::Button button) {}

void SimulateMouseClickAt(WebContents* web_contents,
                          int modifiers,
                          blink::WebMouseEvent::Button button,
                          const gfx::Point& point) {}

gfx::PointF GetCenterCoordinatesOfElementWithId(
    const ToRenderFrameHost& adapter,
    std::string_view id) {}

void SimulateMouseClickOrTapElementWithId(content::WebContents* web_contents,
                                          std::string_view id) {}

void SimulateMouseEvent(WebContents* web_contents,
                        blink::WebInputEvent::Type type,
                        const gfx::Point& point) {}

void SimulateMouseEvent(WebContents* web_contents,
                        blink::WebInputEvent::Type type,
                        blink::WebMouseEvent::Button button,
                        const gfx::Point& point) {}

void SimulateMouseWheelEvent(WebContents* web_contents,
                             const gfx::Point& point,
                             const gfx::Vector2d& delta,
                             const blink::WebMouseWheelEvent::Phase phase) {}

#if !BUILDFLAG(IS_MAC)
void SimulateMouseWheelCtrlZoomEvent(RenderWidgetHost* render_widget_host,
                                     const gfx::Point& point,
                                     bool zoom_in,
                                     blink::WebMouseWheelEvent::Phase phase) {}

void SimulateTouchscreenPinch(WebContents* web_contents,
                              const gfx::PointF& anchor,
                              float scale_change,
                              base::OnceClosure on_complete) {}

#endif  // !BUILDFLAG(IS_MAC)

void SimulateGesturePinchSequence(RenderWidgetHost* render_widget_host,
                                  const gfx::Point& point,
                                  float scale,
                                  blink::WebGestureDevice source_device) {}

void SimulateGesturePinchSequence(WebContents* web_contents,
                                  const gfx::Point& point,
                                  float scale,
                                  blink::WebGestureDevice source_device) {}

void SimulateGestureScrollSequence(RenderWidgetHost* render_widget_host,
                                   const gfx::Point& point,
                                   const gfx::Vector2dF& delta) {}

void SimulateGestureScrollSequence(WebContents* web_contents,
                                   const gfx::Point& point,
                                   const gfx::Vector2dF& delta) {}

void SimulateGestureEvent(RenderWidgetHost* render_widget_host,
                          const blink::WebGestureEvent& gesture_event,
                          const ui::LatencyInfo& latency) {}

void SimulateGestureEvent(WebContents* web_contents,
                          const blink::WebGestureEvent& gesture_event,
                          const ui::LatencyInfo& latency) {}

void SimulateTouchGestureAt(WebContents* web_contents,
                            const gfx::Point& point,
                            blink::WebInputEvent::Type type) {}

void SimulateTapDownAt(WebContents* web_contents, const gfx::Point& point) {}

void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) {}

void SimulateTapWithModifiersAt(WebContents* web_contents,
                                unsigned modifiers,
                                const gfx::Point& point) {}

#if defined(USE_AURA)
void SimulateTouchEventAt(WebContents* web_contents,
                          ui::EventType event_type,
                          const gfx::Point& point) {}

void SimulateLongTapAt(WebContents* web_contents, const gfx::Point& point) {}

// Observer which waits for the selection bounds in a RenderWidgetHostViewAura
// to meet some desired conditions.
class SelectionBoundsWaiter : public TextInputManager::Observer {};

NonZeroCaretSizeWaiter::NonZeroCaretSizeWaiter(WebContents* web_contents) {}

NonZeroCaretSizeWaiter::~NonZeroCaretSizeWaiter() = default;

void NonZeroCaretSizeWaiter::Wait() {}

CaretBoundsUpdateWaiter::CaretBoundsUpdateWaiter(WebContents* web_contents) {}

CaretBoundsUpdateWaiter::~CaretBoundsUpdateWaiter() = default;

void CaretBoundsUpdateWaiter::Wait() {}

BoundingBoxUpdateWaiter::BoundingBoxUpdateWaiter(WebContents* web_contents) {}

BoundingBoxUpdateWaiter::~BoundingBoxUpdateWaiter() = default;

void BoundingBoxUpdateWaiter::Wait() {}
#endif

void SimulateKeyPress(WebContents* web_contents,
                      ui::DomKey key,
                      ui::DomCode code,
                      ui::KeyboardCode key_code,
                      bool control,
                      bool shift,
                      bool alt,
                      bool command) {}

void SimulateKeyPressWithoutChar(WebContents* web_contents,
                                 ui::DomKey key,
                                 ui::DomCode code,
                                 ui::KeyboardCode key_code,
                                 bool control,
                                 bool shift,
                                 bool alt,
                                 bool command) {}

void SimulateProxyHostPostMessage(RenderFrameHost* source_render_frame_host,
                                  RenderFrameHost* target_render_frame_host,
                                  blink::TransferableMessage message) {}

ScopedSimulateModifierKeyPress::ScopedSimulateModifierKeyPress(
    WebContents* web_contents,
    bool control,
    bool shift,
    bool alt,
    bool command)
    :{}

ScopedSimulateModifierKeyPress::~ScopedSimulateModifierKeyPress() {}

void ScopedSimulateModifierKeyPress::MouseClickAt(
    int additional_modifiers,
    blink::WebMouseEvent::Button button,
    const gfx::Point& point) {}

void ScopedSimulateModifierKeyPress::KeyPress(ui::DomKey key,
                                              ui::DomCode code,
                                              ui::KeyboardCode key_code) {}

void ScopedSimulateModifierKeyPress::KeyPressWithoutChar(
    ui::DomKey key,
    ui::DomCode code,
    ui::KeyboardCode key_code) {}

bool IsWebcamAvailableOnSystem(WebContents* web_contents) {}

RenderFrameHost* ConvertToRenderFrameHost(WebContents* web_contents) {}

RenderFrameHost* ConvertToRenderFrameHost(RenderFrameHost* render_frame_host) {}

void ExecuteScriptAsync(const ToRenderFrameHost& adapter,
                        std::string_view script) {}

void ExecuteScriptAsyncWithoutUserGesture(const ToRenderFrameHost& adapter,
                                          std::string_view script) {}

// EvalJsResult methods.
EvalJsResult::EvalJsResult(base::Value value, std::string_view error)
    :{}

EvalJsResult::EvalJsResult(const EvalJsResult& other)
    :{}

const std::string& EvalJsResult::ExtractString() const {}

int EvalJsResult::ExtractInt() const {}

bool EvalJsResult::ExtractBool() const {}

double EvalJsResult::ExtractDouble() const {}

base::Value EvalJsResult::ExtractList() const {}

std::ostream& operator<<(std::ostream& os, const EvalJsResult& bar) {}

namespace {

// Parse a JS stack trace out of |js_error|, detect frames that match
// |source_name|, and interleave the appropriate lines of source code from
// |source| into the error report. This is meant to be useful for scripts that
// are passed to ExecJs/EvalJs functions, and hence dynamically generated.
//
// An adjustment of |column_adjustment_for_line_one| characters is subtracted
// when mapping positions from line 1 of |source|. This is to offset the effect
// of boilerplate added by the script runner.
//
// TODO(nick): Elide snippets to 80 chars, since it is common for sources to not
// include newlines.
std::string AnnotateAndAdjustJsStackTraces(std::string_view js_error,
                                           std::string source_name,
                                           std::string_view source,
                                           int column_adjustment_for_line_one) {}

// Waits for a response from ExecuteJavaScriptForTests, simulating an
// error if the target renderer is destroyed while executing the script.
class ExecuteJavaScriptForTestsWaiter : public WebContentsObserver {};

EvalJsResult EvalJsRunner(
    const ToRenderFrameHost& execution_target,
    std::string_view script,
    std::string_view source_url,
    int options,
    int32_t world_id,
    base::OnceClosure after_script_invoke = base::DoNothing()) {}

}  // namespace

::testing::AssertionResult ExecJs(const ToRenderFrameHost& execution_target,
                                  std::string_view script,
                                  int options,
                                  int32_t world_id) {}

EvalJsResult EvalJs(const ToRenderFrameHost& execution_target,
                    std::string_view script,
                    int options,
                    int32_t world_id,
                    base::OnceClosure after_script_invoke) {}

EvalJsResult EvalJsAfterLifecycleUpdate(
    const ToRenderFrameHost& execution_target,
    std::string_view raf_script,
    std::string_view script,
    int options,
    int32_t world_id) {}

RenderFrameHost* FrameMatchingPredicateOrNullptr(
    Page& page,
    base::RepeatingCallback<bool(RenderFrameHost*)> predicate) {}

RenderFrameHost* FrameMatchingPredicate(
    Page& page,
    base::RepeatingCallback<bool(RenderFrameHost*)> predicate) {}

bool FrameMatchesName(std::string_view name, RenderFrameHost* frame) {}

bool FrameIsChildOfMainFrame(RenderFrameHost* frame) {}

bool FrameHasSourceUrl(const GURL& url, RenderFrameHost* frame) {}

RenderFrameHost* ChildFrameAt(const ToRenderFrameHost& adapter, size_t index) {}

bool HasOriginKeyedProcess(RenderFrameHost* frame) {}

bool HasSandboxedSiteInstance(RenderFrameHost* frame) {}

std::vector<RenderFrameHost*> CollectAllRenderFrameHosts(
    RenderFrameHost* starting_rfh) {}

std::vector<RenderFrameHost*> CollectAllRenderFrameHosts(Page& page) {}

std::vector<RenderFrameHost*> CollectAllRenderFrameHosts(
    WebContents* web_contents) {}

std::vector<WebContents*> GetAllWebContents() {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
bool ExecuteWebUIResourceTest(WebContents* web_contents) {
  // Inject WebUI test runner script.
  std::string script;
  scoped_refptr<base::RefCountedMemory> bytes =
      ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
          IDR_ASH_WEBUI_COMMON_WEBUI_RESOURCE_TEST_JS);

  if (HasGzipHeader(*bytes)) {
    AppendGzippedResource(*bytes, &script);
  } else {
    auto chars = base::as_chars(base::span(*bytes));
    script.append(chars.data(), chars.size());
  }

  script.append("\n");
  ExecuteScriptAsync(web_contents, script);

  DOMMessageQueue message_queue(web_contents);

  bool should_wait_flag = base::CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kWaitForDebuggerWebUI);

  if (should_wait_flag) {
    ExecuteScriptAsync(
        web_contents,
        "window.waitUser = true; "
        "window.go = function() { window.waitUser = false }; "
        "console.log('Waiting for debugger...'); "
        "console.log('Run: go() in the JS console when you are ready.');");
  }

  ExecuteScriptAsync(web_contents, "runTests()");

  std::string message;
  do {
    if (!message_queue.WaitForMessage(&message))
      return false;
  } while (message.compare("\"PENDING\"") == 0);

  return message.compare("\"SUCCESS\"") == 0;
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

std::string GetCookies(BrowserContext* browser_context,
                       const GURL& url,
                       net::CookieOptions::SameSiteCookieContext context,
                       net::CookiePartitionKeyCollection key_collection) {}

std::vector<net::CanonicalCookie> GetCanonicalCookies(
    BrowserContext* browser_context,
    const GURL& url,
    net::CookiePartitionKeyCollection key_collection) {}

bool SetCookie(BrowserContext* browser_context,
               const GURL& url,
               const std::string& value,
               net::CookieOptions::SameSiteCookieContext context,
               net::CookiePartitionKey* cookie_partition_key) {}

uint32_t DeleteCookies(BrowserContext* browser_context,
                       network::mojom::CookieDeletionFilter filter) {}

void FetchHistogramsFromChildProcesses() {}

void SetupCrossSiteRedirector(net::EmbeddedTestServer* embedded_test_server) {}

void SetFileSystemAccessPermissionContext(
    BrowserContext* browser_context,
    FileSystemAccessPermissionContext* permission_context) {}

bool WaitForRenderFrameReady(RenderFrameHost* rfh) {}

void WaitForAccessibilityFocusChange() {}

ui::AXNodeData GetFocusedAccessibilityNodeInfo(WebContents* web_contents) {}

bool AccessibilityTreeContainsNodeWithName(ui::BrowserAccessibility* node,
                                           std::string_view name) {}

void WaitForAccessibilityTreeToChange(WebContents* web_contents) {}

void WaitForAccessibilityTreeToContainNodeWithName(WebContents* web_contents,
                                                   std::string_view name) {}

ui::AXTreeUpdate GetAccessibilityTreeSnapshot(WebContents* web_contents) {}

ui::AXTreeUpdate GetAccessibilityTreeSnapshotFromId(
    const ui::AXTreeID& tree_id) {}

ui::AXPlatformNodeDelegate* GetRootAccessibilityNode(
    WebContents* web_contents) {}

FindAccessibilityNodeCriteria::FindAccessibilityNodeCriteria() = default;

FindAccessibilityNodeCriteria::~FindAccessibilityNodeCriteria() = default;

ui::AXPlatformNodeDelegate* FindAccessibilityNode(
    WebContents* web_contents,
    const FindAccessibilityNodeCriteria& criteria) {}

ui::AXPlatformNodeDelegate* FindAccessibilityNodeInSubtree(
    ui::AXPlatformNodeDelegate* node,
    const FindAccessibilityNodeCriteria& criteria) {}

#if BUILDFLAG(IS_WIN)
template <typename T>
Microsoft::WRL::ComPtr<T> QueryInterfaceFromNode(
    ui::AXPlatformNodeDelegate* node) {
  Microsoft::WRL::ComPtr<T> result;
  EXPECT_HRESULT_SUCCEEDED(
      node->GetNativeViewAccessible()->QueryInterface(__uuidof(T), &result));
  return result;
}

void UiaGetPropertyValueVtArrayVtUnknownValidate(
    PROPERTYID property_id,
    ui::AXPlatformNodeDelegate* target_node,
    const std::vector<std::string>& expected_names) {
  ASSERT_TRUE(target_node);

  base::win::ScopedVariant result_variant;
  Microsoft::WRL::ComPtr<IRawElementProviderSimple> node_provider =
      QueryInterfaceFromNode<IRawElementProviderSimple>(target_node);

  node_provider->GetPropertyValue(property_id, result_variant.Receive());
  ASSERT_EQ(VT_ARRAY | VT_UNKNOWN, result_variant.type());
  ASSERT_EQ(1u, SafeArrayGetDim(V_ARRAY(result_variant.ptr())));

  LONG lower_bound, upper_bound, size;
  ASSERT_HRESULT_SUCCEEDED(
      SafeArrayGetLBound(V_ARRAY(result_variant.ptr()), 1, &lower_bound));
  ASSERT_HRESULT_SUCCEEDED(
      SafeArrayGetUBound(V_ARRAY(result_variant.ptr()), 1, &upper_bound));
  size = upper_bound - lower_bound + 1;
  ASSERT_EQ(static_cast<LONG>(expected_names.size()), size);

  std::vector<std::string> names;
  for (LONG i = 0; i < size; ++i) {
    Microsoft::WRL::ComPtr<IUnknown> unknown_element;
    ASSERT_HRESULT_SUCCEEDED(
        SafeArrayGetElement(V_ARRAY(result_variant.ptr()), &i,
                            static_cast<void**>(&unknown_element)));
    ASSERT_NE(nullptr, unknown_element);

    Microsoft::WRL::ComPtr<IRawElementProviderSimple>
        raw_element_provider_simple;
    ASSERT_HRESULT_SUCCEEDED(unknown_element.As(&raw_element_provider_simple));
    ASSERT_NE(nullptr, raw_element_provider_simple);

    base::win::ScopedVariant name;
    ASSERT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPropertyValue(
        UIA_NamePropertyId, name.Receive()));
    ASSERT_EQ(VT_BSTR, name.type());
    names.push_back(base::WideToUTF8(
        std::wstring(V_BSTR(name.ptr()), SysStringLen(V_BSTR(name.ptr())))));
  }

  ASSERT_THAT(names, ::testing::UnorderedElementsAreArray(expected_names));
}
#endif

RenderWidgetHost* GetKeyboardLockWidget(WebContents* web_contents) {}

RenderWidgetHost* GetMouseLockWidget(WebContents* web_contents) {}

void RequestKeyboardLock(
    WebContents* web_contents,
    std::optional<base::flat_set<ui::DomCode>> codes,
    base::OnceCallback<void(blink::mojom::KeyboardLockRequestResult)>
        callback) {}

void CancelKeyboardLock(WebContents* web_contents) {}

ScreenOrientationDelegate* GetScreenOrientationDelegate() {}

std::vector<RenderWidgetHostView*> GetInputEventRouterRenderWidgetHostViews(
    WebContents* web_contents) {}

RenderWidgetHost* GetFocusedRenderWidgetHost(WebContents* web_contents) {}

bool IsRenderWidgetHostFocused(const RenderWidgetHost* host) {}

WebContents* GetFocusedWebContents(WebContents* web_contents) {}

namespace {

RenderFrameMetadataProviderImpl* RenderFrameMetadataProviderFromRenderFrameHost(
    RenderFrameHost* render_frame_host) {}

}  // namespace

TitleWatcher::TitleWatcher(WebContents* web_contents,
                           std::u16string_view expected_title)
    :{}

void TitleWatcher::AlsoWaitForTitle(std::u16string_view expected_title) {}

TitleWatcher::~TitleWatcher() = default;

const std::u16string& TitleWatcher::WaitAndGetTitle() {}

void TitleWatcher::DidStopLoading() {}

void TitleWatcher::TitleWasSet(NavigationEntry* entry) {}

void TitleWatcher::TestTitle() {}

RenderProcessHostWatcher::RenderProcessHostWatcher(
    RenderProcessHost* render_process_host,
    WatchType type)
    :{}

RenderProcessHostWatcher::RenderProcessHostWatcher(WebContents* web_contents,
                                                   WatchType type)
    :{}
RenderProcessHostWatcher::~RenderProcessHostWatcher() = default;

void RenderProcessHostWatcher::Wait() {}

void RenderProcessHostWatcher::QuitRunLoop() {}

void RenderProcessHostWatcher::RenderProcessReady(RenderProcessHost* host) {}

void RenderProcessHostWatcher::RenderProcessExited(
    RenderProcessHost* host,
    const ChildProcessTerminationInfo& info) {}

void RenderProcessHostWatcher::RenderProcessHostDestroyed(
    RenderProcessHost* host) {}

RenderProcessHostKillWaiter::RenderProcessHostKillWaiter(
    RenderProcessHost* render_process_host,
    std::string_view uma_name)
    :{}

std::optional<int> RenderProcessHostKillWaiter::Wait() {}

RenderProcessHostBadMojoMessageWaiter::RenderProcessHostBadMojoMessageWaiter(
    RenderProcessHost* render_process_host)
    :{}

RenderProcessHostBadMojoMessageWaiter::
    ~RenderProcessHostBadMojoMessageWaiter() {}

std::optional<std::string> RenderProcessHostBadMojoMessageWaiter::Wait() {}

void RenderProcessHostBadMojoMessageWaiter::OnBadMojoMessage(
    int render_process_id,
    const std::string& error) {}

class DOMMessageQueue::MessageObserver : public WebContentsObserver {};

DOMMessageQueue::DOMMessageQueue() {}

DOMMessageQueue::DOMMessageQueue(WebContents* web_contents) {}

DOMMessageQueue::DOMMessageQueue(RenderFrameHost* render_frame_host) {}

DOMMessageQueue::~DOMMessageQueue() = default;

void DOMMessageQueue::PrimaryMainFrameRenderProcessGone(
    base::TerminationStatus status) {}

void DOMMessageQueue::RenderFrameDeleted() {}

void DOMMessageQueue::ClearQueue() {}

void DOMMessageQueue::OnDomMessageReceived(const std::string& message) {}

void DOMMessageQueue::OnWebContentsCreated(WebContents* contents) {}

void DOMMessageQueue::OnBackingWebContentsDestroyed(MessageObserver* observer) {}

void DOMMessageQueue::SetOnMessageAvailableCallback(
    base::OnceClosure callback) {}

bool DOMMessageQueue::WaitForMessage(std::string* message) {}

bool DOMMessageQueue::PopMessage(std::string* message) {}

bool DOMMessageQueue::HasMessages() {}

WebContentsAddedObserver::WebContentsAddedObserver()
    :{}

WebContentsAddedObserver::~WebContentsAddedObserver() = default;

void WebContentsAddedObserver::WebContentsCreated(WebContents* web_contents) {}

WebContents* WebContentsAddedObserver::GetWebContents() {}

bool RequestFrame(WebContents* web_contents) {}

RenderFrameSubmissionObserver::RenderFrameSubmissionObserver(
    RenderFrameMetadataProviderImpl* render_frame_metadata_provider)
    :{}

RenderFrameSubmissionObserver::RenderFrameSubmissionObserver(
    FrameTreeNode* node)
    :{}

RenderFrameSubmissionObserver::RenderFrameSubmissionObserver(
    WebContents* web_contents)
    :{}

RenderFrameSubmissionObserver::RenderFrameSubmissionObserver(
    RenderFrameHost* rfh)
    :{}

RenderFrameSubmissionObserver::~RenderFrameSubmissionObserver() {}

void RenderFrameSubmissionObserver::WaitForAnyFrameSubmission() {}

void RenderFrameSubmissionObserver::WaitForMetadataChange() {}

void RenderFrameSubmissionObserver::WaitForPageScaleFactor(
    float expected_page_scale_factor,
    const float tolerance) {}

void RenderFrameSubmissionObserver::WaitForExternalPageScaleFactor(
    float expected_external_page_scale_factor,
    const float tolerance) {}

void RenderFrameSubmissionObserver::WaitForScrollOffset(
    const gfx::PointF& expected_offset) {}

void RenderFrameSubmissionObserver::WaitForScrollOffsetAtTop(
    bool expected_scroll_offset_at_top) {}

const cc::RenderFrameMetadata&
RenderFrameSubmissionObserver::LastRenderFrameMetadata() const {}

void RenderFrameSubmissionObserver::NotifyOnNextMetadataChange(
    base::OnceClosure closure) {}

void RenderFrameSubmissionObserver::Quit() {}

void RenderFrameSubmissionObserver::Wait() {}

void RenderFrameSubmissionObserver::
    OnRenderFrameMetadataChangedBeforeActivation(
        const cc::RenderFrameMetadata& metadata) {}

void RenderFrameSubmissionObserver::OnRenderFrameMetadataChangedAfterActivation(
    base::TimeTicks activation_time) {}

void RenderFrameSubmissionObserver::OnRenderFrameSubmission() {}

void RenderFrameSubmissionObserver::OnLocalSurfaceIdChanged(
    const cc::RenderFrameMetadata& metadata) {}

MainThreadFrameObserver::MainThreadFrameObserver(
    RenderWidgetHost* render_widget_host)
    :{}

MainThreadFrameObserver::~MainThreadFrameObserver() = default;

void MainThreadFrameObserver::Wait() {}

void MainThreadFrameObserver::Quit(bool) {}

InputMsgWatcher::InputMsgWatcher(RenderWidgetHost* render_widget_host,
                                 blink::WebInputEvent::Type type)
    :{}

InputMsgWatcher::~InputMsgWatcher() {}

void InputMsgWatcher::OnInputEventAck(
    blink::mojom::InputEventResultSource ack_source,
    blink::mojom::InputEventResultState ack_state,
    const blink::WebInputEvent& event) {}

void InputMsgWatcher::OnInputEvent(const blink::WebInputEvent& event) {}

bool InputMsgWatcher::HasReceivedAck() const {}

blink::mojom::InputEventResultState InputMsgWatcher::WaitForAck() {}

blink::mojom::InputEventResultState
InputMsgWatcher::GetAckStateWaitIfNecessary() {}

InputEventAckWaiter::InputEventAckWaiter(RenderWidgetHost* render_widget_host,
                                         InputEventAckPredicate predicate)
    :{}

namespace {
InputEventAckWaiter::InputEventAckPredicate EventAckHasType(
    blink::WebInputEvent::Type type) {}
}  // namespace

InputEventAckWaiter::InputEventAckWaiter(RenderWidgetHost* render_widget_host,
                                         blink::WebInputEvent::Type type)
    :{}

InputEventAckWaiter::~InputEventAckWaiter() {}

void InputEventAckWaiter::Wait() {}

void InputEventAckWaiter::Reset() {}

void InputEventAckWaiter::OnInputEventAck(
    blink::mojom::InputEventResultSource source,
    blink::mojom::InputEventResultState state,
    const blink::WebInputEvent& event) {}

// TODO(dcheng): Make the test clipboard on different threads share the
// same backing store. crbug.com/629765
// TODO(slangley): crbug.com/775830 - Cleanup BrowserTestClipboardScope now that
// there is no need to thread hop for Windows.
BrowserTestClipboardScope::BrowserTestClipboardScope() {}

BrowserTestClipboardScope::~BrowserTestClipboardScope() {}

void BrowserTestClipboardScope::SetRtf(const std::string& rtf) {}

void BrowserTestClipboardScope::SetText(const std::string& text) {}

void BrowserTestClipboardScope::GetText(std::string* result) {}

class FrameFocusedObserver::FrameTreeNodeObserverImpl
    : public FrameTreeNode::Observer {};

FrameFocusedObserver::FrameFocusedObserver(RenderFrameHost* owner_host)
    :{}

FrameFocusedObserver::~FrameFocusedObserver() = default;

void FrameFocusedObserver::Wait() {}

class FrameDeletedObserver::FrameTreeNodeObserverImpl
    : public FrameTreeNode::Observer {};

FrameDeletedObserver::FrameDeletedObserver(RenderFrameHost* owner_host)
    :{}

FrameDeletedObserver::~FrameDeletedObserver() = default;

void FrameDeletedObserver::Wait() {}

bool FrameDeletedObserver::IsDeleted() const {}

int FrameDeletedObserver::GetFrameTreeNodeId() const {}

TestNavigationManager::TestNavigationManager(WebContents* web_contents,
                                             const GURL& url)
    :{}

TestNavigationManager::~TestNavigationManager() {}

bool TestNavigationManager::WaitForFirstYieldAfterDidStartNavigation() {}

bool TestNavigationManager::WaitForRequestStart() {}

bool TestNavigationManager::WaitForLoaderStart() {}

bool TestNavigationManager::WaitForRequestRedirected() {}

void TestNavigationManager::ResumeNavigation() {}

NavigationHandle* TestNavigationManager::GetNavigationHandle() {}

ukm::SourceId TestActivationManager::next_page_ukm_source_id() const {}

bool TestNavigationManager::WaitForResponse() {}

bool TestNavigationManager::WaitForNavigationFinished() {}

void TestNavigationManager::WaitForSpeculativeRenderFrameHostCreation() {}

void TestNavigationManager::DidStartNavigation(NavigationHandle* handle) {}

void TestNavigationManager::DidUpdateNavigationHandleTiming(
    NavigationHandle* handle) {}

void TestNavigationManager::DidRedirectNavigation(NavigationHandle* handle) {}

void TestNavigationManager::DidFinishNavigation(NavigationHandle* handle) {}

void TestNavigationManager::OnWillStartRequest() {}

void TestNavigationManager::OnWillRedirectRequest() {}

void TestNavigationManager::OnWillProcessResponse() {}

void TestNavigationManager::RenderFrameCreated(
    RenderFrameHost* render_frame_host) {}

RenderFrameHost* TestNavigationManager::GetCreatedSpeculativeRFH() {}

// TODO(csharrison): Remove CallResumeForTesting method calls in favor of doing
// it through the throttle.
bool TestNavigationManager::WaitForDesiredState() {}

void TestNavigationManager::OnNavigationStateChanged() {}

void TestNavigationManager::ResumeIfPaused() {}

bool TestNavigationManager::ShouldMonitorNavigation(NavigationHandle* handle) {}

void TestNavigationManager::AllowNestableTasks() {}

void TestNavigationManager::WriteIntoTrace(
    perfetto::TracedValue context) const {}

namespace {

// A helper CommitDeferringCondition instantiated and inserted into all
// navigations from TestActivationManager. It delegates WillCommitNavigation
// method of the CommitDeferringCondition back to the TestActivationManager so
// that the manager can see and decide how to proceed with the condition for
// every occurring navigation.
class TestActivationManagerCondition : public CommitDeferringCondition {};

// We need this wrapper since the TestActivationManager can be destroyed while
// navigations are ongoing so we need to pass the callback with a WeakPtr.
// However, we can't bind a WeakPtr to a method that returns non-void so we use
// this wrapper to provide the default return value.
CommitDeferringCondition::Result ConditionCallbackWeakWrapper(
    base::WeakPtr<TestActivationManager> manager,
    base::RepeatingCallback<
        CommitDeferringCondition::Result(TestActivationManager*,
                                         CommitDeferringCondition&,
                                         base::OnceClosure)> manager_func,
    CommitDeferringCondition& condition,
    base::OnceClosure resume_callback) {}

}  // namespace

class TestActivationManager::ConditionInserter {};

TestActivationManager::TestActivationManager(WebContents* web_contents,
                                             const GURL& url)
    :{}

TestActivationManager::~TestActivationManager() {}

bool TestActivationManager::WaitForBeforeChecks() {}

bool TestActivationManager::WaitForAfterChecks() {}

void TestActivationManager::WaitForNavigationFinished() {}

void TestActivationManager::ResumeActivation() {}

NavigationHandle* TestActivationManager::GetNavigationHandle() {}

void TestActivationManager::SetCallbackCalledAfterActivationIsReady(
    base::OnceClosure callback) {}

CommitDeferringCondition::Result TestActivationManager::FirstConditionCallback(
    CommitDeferringCondition& condition,
    base::OnceClosure resume_callback) {}

CommitDeferringCondition::Result TestActivationManager::LastConditionCallback(
    CommitDeferringCondition& condition,
    base::OnceClosure resume_callback) {}

void TestActivationManager::DidFinishNavigation(NavigationHandle* handle) {}

bool TestActivationManager::WaitForDesiredState() {}

void TestActivationManager::StopWaitingIfNeeded() {}

NavigationHandleCommitObserver::NavigationHandleCommitObserver(
    content::WebContents* web_contents,
    const GURL& url)
    :{}

void NavigationHandleCommitObserver::DidFinishNavigation(
    content::NavigationHandle* handle) {}

WebContentsConsoleObserver::WebContentsConsoleObserver(
    content::WebContents* web_contents)
    :{}
WebContentsConsoleObserver::~WebContentsConsoleObserver() = default;

bool WebContentsConsoleObserver::Wait() {}

void WebContentsConsoleObserver::SetFilter(Filter filter) {}

void WebContentsConsoleObserver::SetPattern(std::string pattern) {}

std::string WebContentsConsoleObserver::GetMessageAt(size_t index) const {}

void WebContentsConsoleObserver::OnDidAddMessageToConsole(
    RenderFrameHost* source_frame,
    blink::mojom::ConsoleMessageLevel log_level,
    const std::u16string& message_contents,
    int32_t line_no,
    const std::u16string& source_id,
    const std::optional<std::u16string>& untrusted_stack_trace) {}

namespace {
static constexpr int kEnableLogMessageId =;
static constexpr char kEnableLogMessage[] =;
static constexpr int kDisableLogMessageId =;
static constexpr char kDisableLogMessage[] =;
}  // namespace

DevToolsInspectorLogWatcher::DevToolsInspectorLogWatcher(
    WebContents* web_contents) {}

DevToolsInspectorLogWatcher::~DevToolsInspectorLogWatcher() {}

void DevToolsInspectorLogWatcher::DispatchProtocolMessage(
    DevToolsAgentHost* host,
    base::span<const uint8_t> message) {}

void DevToolsInspectorLogWatcher::AgentHostClosed(DevToolsAgentHost* host) {}

void DevToolsInspectorLogWatcher::FlushAndStopWatching() {}

namespace {
mojo::Remote<blink::mojom::FileSystemManager> GetFileSystemManager(
    RenderProcessHost* rph,
    const blink::StorageKey& storage_key) {}
}  // namespace

// static
void PwnMessageHelper::FileSystemCreate(RenderProcessHost* process,
                                        int request_id,
                                        GURL path,
                                        bool exclusive,
                                        bool is_directory,
                                        bool recursive,
                                        const blink::StorageKey& storage_key) {}

// static
void PwnMessageHelper::FileSystemWrite(RenderProcessHost* process,
                                       int request_id,
                                       GURL file_path,
                                       std::string blob_uuid,
                                       int64_t position,
                                       const blink::StorageKey& storage_key) {}

void PwnMessageHelper::OpenURL(RenderFrameHost* render_frame_host,
                               const GURL& url) {}

#if defined(USE_AURA)
namespace {

// This class interacts with the internals of the DelegatedFrameHost without
// exposing them in the header.
class EvictionStateWaiter : public DelegatedFrameHost::Observer {};

}  // namespace

void VerifyStaleContentOnFrameEviction(
    RenderWidgetHostView* render_widget_host_view) {}

#endif  // defined(USE_AURA)

// static
void BlobURLStoreInterceptor::Intercept(GURL target_url,
                                        storage::BlobUrlRegistry* registry,
                                        mojo::ReceiverId receiver_id) {}

blink::mojom::BlobURLStore* BlobURLStoreInterceptor::GetForwardingInterface() {}

void BlobURLStoreInterceptor::Register(
    mojo::PendingRemote<blink::mojom::Blob> blob,
    const GURL& url,
    // TODO(crbug.com/40775506): Remove these once experiment is over.
    const base::UnguessableToken& unsafe_agent_cluster_id,
    const std::optional<net::SchemefulSite>& unsafe_top_level_site,
    RegisterCallback callback) {}

BlobURLStoreInterceptor::BlobURLStoreInterceptor(GURL target_url)
    :{}
BlobURLStoreInterceptor::~BlobURLStoreInterceptor() = default;

namespace {

int LoadBasicRequest(
    network::mojom::URLLoaderFactory* url_loader_factory,
    const GURL& url,
    int load_flags,
    const std::optional<url::Origin>& request_initiator = std::nullopt) {}

}  // namespace

int LoadBasicRequest(network::mojom::NetworkContext* network_context,
                     const GURL& url,
                     int load_flags) {}

int LoadBasicRequest(RenderFrameHost* frame, const GURL& url) {}

void EnsureCookiesFlushed(BrowserContext* browser_context) {}

bool TestGuestAutoresize(WebContents* embedder_web_contents,
                         RenderFrameHost* guest_main_frame) {}

RenderWidgetHostMouseEventMonitor::RenderWidgetHostMouseEventMonitor(
    RenderWidgetHost* host)
    :{}

RenderWidgetHostMouseEventMonitor::~RenderWidgetHostMouseEventMonitor() {}

DidStartNavigationObserver::DidStartNavigationObserver(WebContents* contents)
    :{}
DidStartNavigationObserver::~DidStartNavigationObserver() = default;

void DidStartNavigationObserver::DidStartNavigation(NavigationHandle* handle) {}

void DidStartNavigationObserver::DidFinishNavigation(NavigationHandle* handle) {}

ProxyDSFObserver::ProxyDSFObserver() {}

ProxyDSFObserver::~ProxyDSFObserver() {}

void ProxyDSFObserver::WaitForOneProxyHostCreation() {}

void ProxyDSFObserver::OnCreation(RenderFrameProxyHost* rfph) {}

bool CompareWebContentsOutputToReference(
    WebContents* web_contents,
    const base::FilePath& expected_path,
    const gfx::Size& snapshot_size,
    const cc::PixelComparator& comparator) {}

RenderFrameHostChangedCallbackRunner::RenderFrameHostChangedCallbackRunner(
    WebContents* content,
    RenderFrameHostChangedCallback callback)
    :{}

RenderFrameHostChangedCallbackRunner::~RenderFrameHostChangedCallbackRunner() =
    default;

void RenderFrameHostChangedCallbackRunner::RenderFrameHostChanged(
    RenderFrameHost* old_host,
    RenderFrameHost* new_host) {}

DidFinishNavigationObserver::DidFinishNavigationObserver(
    WebContents* web_contents,
    base::RepeatingCallback<void(NavigationHandle*)> callback)
    :{}

DidFinishNavigationObserver::DidFinishNavigationObserver(
    RenderFrameHost* render_frame_host,
    base::RepeatingCallback<void(NavigationHandle*)> callback)
    :{}

DidFinishNavigationObserver::~DidFinishNavigationObserver() = default;

void DidFinishNavigationObserver::DidFinishNavigation(
    NavigationHandle* navigation_handle) {}

// Since the loading state might be switched more than once due to navigation
// restart, the following helper methods for history traversal need to call
// `WaitForNavigationFinished()` to ensure the navigation is finally committed
// and `WaitForLoadStop()` to ensure the `WebContents` finishes the last
// loading.
bool HistoryGoToIndex(WebContents* wc, int index) {}

bool HistoryGoToOffset(WebContents* wc, int offset) {}

bool HistoryGoBack(WebContents* wc) {}

bool HistoryGoForward(WebContents* wc) {}

CreateAndLoadWebContentsObserver::CreateAndLoadWebContentsObserver(
    int num_expected_contents)
    :{}

CreateAndLoadWebContentsObserver::~CreateAndLoadWebContentsObserver() = default;

void CreateAndLoadWebContentsObserver::OnWebContentsCreated(
    WebContents* web_contents) {}

WebContents* CreateAndLoadWebContentsObserver::Wait() {}

CookieChangeObserver::CookieChangeObserver(content::WebContents* web_contents,
                                           int num_expected_calls)
    :{}

CookieChangeObserver::~CookieChangeObserver() = default;

void CookieChangeObserver::Wait() {}

void CookieChangeObserver::OnCookiesAccessed(
    content::RenderFrameHost* render_frame_host,
    const content::CookieAccessDetails& details) {}

void CookieChangeObserver::OnCookiesAccessed(
    content::NavigationHandle* navigation,
    const content::CookieAccessDetails& details) {}

void CookieChangeObserver::OnCookieAccessed(
    const content::CookieAccessDetails& details) {}

SpeculativeRenderFrameHostObserver::SpeculativeRenderFrameHostObserver(
    content::WebContents* web_contents,
    const GURL& url)
    :{}

SpeculativeRenderFrameHostObserver::~SpeculativeRenderFrameHostObserver() =
    default;

void SpeculativeRenderFrameHostObserver::Wait() {}

void SpeculativeRenderFrameHostObserver::RenderFrameCreated(
    RenderFrameHost* render_frame_host) {}

SpareRenderProcessObserver::SpareRenderProcessObserver() {}

SpareRenderProcessObserver::~SpareRenderProcessObserver() = default;

void SpareRenderProcessObserver::SpareRenderProcessHostChanged(
    RenderProcessHost* render_process_host) {}

RenderProcessHost* SpareRenderProcessObserver::spare_render_process_host() {}

void SpareRenderProcessObserver::WaitForSpareRenderProcessCreation() {}

base::CallbackListSubscription RegisterWebContentsCreationCallback(
    base::RepeatingCallback<void(WebContents*)> callback) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void SetCapturedSurfaceControllerFactoryForTesting(
    base::RepeatingCallback<std::unique_ptr<MockCapturedSurfaceController>(
        GlobalRenderFrameHostId,
        WebContentsMediaCaptureId)> factory) {}
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

}  // namespace content