chromium/content/test/test_web_contents.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 "content/test/test_web_contents.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/no_destructor.h"
#include "content/browser/browser_url_handler_impl.h"
#include "content/browser/display_cutout/display_cutout_host_impl.h"
#include "content/browser/preloading/prerender/prerender_host.h"
#include "content/browser/preloading/prerender/prerender_host_registry.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/debug_urls.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/navigator.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_view_host_impl.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/render_message_filter.mojom.h"
#include "content/public/common/referrer_type_converters.h"
#include "content/public/common/url_utils.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/prerender_test_util.h"
#include "content/test/navigation_simulator_impl.h"
#include "content/test/test_render_view_host.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/page_state/page_state.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "third_party/blink/public/mojom/speculation_rules/speculation_rules.mojom-shared.h"
#include "ui/base/page_transition_types.h"

namespace content {

namespace {

RenderProcessHostFactory* GetMockProcessFactory() {}

}  // namespace

TestWebContents::TestWebContents(BrowserContext* browser_context)
    :{}

std::unique_ptr<TestWebContents> TestWebContents::Create(
    BrowserContext* browser_context,
    scoped_refptr<SiteInstance> instance) {}

TestWebContents* TestWebContents::Create(const CreateParams& params) {}

TestWebContents::~TestWebContents() = default;

const TestRenderFrameHost* TestWebContents::GetPrimaryMainFrame() const {}

TestRenderFrameHost* TestWebContents::GetPrimaryMainFrame() {}

TestRenderViewHost* TestWebContents::GetRenderViewHost() {}

TestRenderFrameHost* TestWebContents::GetSpeculativePrimaryMainFrame() {}

int TestWebContents::DownloadImage(const GURL& url,
                                   bool is_favicon,
                                   const gfx::Size& preferred_size,
                                   uint32_t max_bitmap_size,
                                   bool bypass_cache,
                                   ImageDownloadCallback callback) {}

const GURL& TestWebContents::GetLastCommittedURL() {}

const std::u16string& TestWebContents::GetTitle() {}

void TestWebContents::SetTabSwitchStartTime(base::TimeTicks start_time,
                                            bool destination_is_loaded) {}

const std::string& TestWebContents::GetSaveFrameHeaders() {}

const std::u16string& TestWebContents::GetSuggestedFileName() {}

bool TestWebContents::HasPendingDownloadImage(const GURL& url) {}

void TestWebContents::OnWebPreferencesChanged() {}

void TestWebContents::SetBackForwardCacheSupported(bool supported) {}

bool TestWebContents::IsPageFrozen() {}

bool TestWebContents::TestDidDownloadImage(
    const GURL& url,
    int http_status_code,
    const std::vector<SkBitmap>& bitmaps,
    const std::vector<gfx::Size>& original_bitmap_sizes) {}

void TestWebContents::TestSetFaviconURL(
    const std::vector<blink::mojom::FaviconURLPtr>& favicon_urls) {}

void TestWebContents::TestUpdateFaviconURL(
    const std::vector<blink::mojom::FaviconURLPtr>& favicon_urls) {}

void TestWebContents::SetLastCommittedURL(const GURL& url) {}

void TestWebContents::SetTitle(const std::u16string& title) {}

void TestWebContents::SetMainFrameMimeType(const std::string& mime_type) {}

void TestWebContents::SetMainFrameSize(const gfx::Size& frame_size) {}

const std::string& TestWebContents::GetContentsMimeType() {}

void TestWebContents::SetIsCurrentlyAudible(bool audible) {}

void TestWebContents::TestDidReceiveMouseDownEvent() {}

void TestWebContents::TestDidFinishLoad(const GURL& url) {}

void TestWebContents::TestDidFailLoadWithError(const GURL& url,
                                               int error_code) {}

void TestWebContents::TestDidFirstVisuallyNonEmptyPaint() {}

bool TestWebContents::CrossProcessNavigationPending() {}

bool TestWebContents::CreateRenderViewForRenderManager(
    RenderViewHost* render_view_host,
    const std::optional<blink::FrameToken>& opener_frame_token,
    RenderFrameProxyHost* proxy_host) {}

std::unique_ptr<WebContents> TestWebContents::Clone() {}

void TestWebContents::NavigateAndCommit(const GURL& url,
                                        ui::PageTransition transition) {}

void TestWebContents::NavigateAndFail(const GURL& url, int error_code) {}

void TestWebContents::TestSetIsLoading(bool value) {}

void TestWebContents::CommitPendingNavigation() {}

RenderViewHostDelegateView* TestWebContents::GetDelegateView() {}

void TestWebContents::SetOpener(WebContents* opener) {}

void TestWebContents::SetIsCrashed(base::TerminationStatus status,
                                   int error_code) {}

void TestWebContents::AddPendingContents(
    std::unique_ptr<WebContentsImpl> contents,
    const GURL& target_url) {}

FrameTree* TestWebContents::CreateNewWindow(
    RenderFrameHostImpl* opener,
    const mojom::CreateNewWindowParams& params,
    bool is_new_browsing_instance,
    bool has_user_gesture,
    SessionStorageNamespace* session_storage_namespace) {}

RenderWidgetHostImpl* TestWebContents::CreateNewPopupWidget(
    base::SafeRef<SiteInstanceGroup> site_instance_group,
    int32_t route_id,
    mojo::PendingAssociatedReceiver<blink::mojom::PopupWidgetHost>
        blink_popup_widget_host,
    mojo::PendingAssociatedReceiver<blink::mojom::WidgetHost> blink_widget_host,
    mojo::PendingAssociatedRemote<blink::mojom::Widget> blink_widget) {}

void TestWebContents::ShowCreatedWindow(
    RenderFrameHostImpl* opener,
    int route_id,
    WindowOpenDisposition disposition,
    const blink::mojom::WindowFeatures& window_features,
    bool user_gesture) {}

void TestWebContents::ShowCreatedWidget(int process_id,
                                        int route_id,
                                        const gfx::Rect& initial_rect,
                                        const gfx::Rect& initial_anchor_rect) {}

void TestWebContents::SaveFrameWithHeaders(
    const GURL& url,
    const Referrer& referrer,
    const std::string& headers,
    const std::u16string& suggested_filename,
    RenderFrameHost* rfh,
    bool is_subresource) {}

bool TestWebContents::GetPauseSubresourceLoadingCalled() {}

void TestWebContents::ResetPauseSubresourceLoadingCalled() {}

void TestWebContents::SetLastActiveTimeTicks(
    base::TimeTicks last_active_time_ticks) {}

void TestWebContents::SetLastActiveTime(base::Time last_active_time) {}

void TestWebContents::TestIncrementUsbActiveFrameCount() {}

void TestWebContents::TestDecrementUsbActiveFrameCount() {}

void TestWebContents::TestIncrementBluetoothConnectedDeviceCount() {}

void TestWebContents::TestDecrementBluetoothConnectedDeviceCount() {}

base::UnguessableToken TestWebContents::GetAudioGroupId() {}

void TestWebContents::SetPageFrozen(bool frozen) {}

bool TestWebContents::IsBackForwardCacheSupported() {}

const std::optional<blink::mojom::PictureInPictureWindowOptions>&
TestWebContents::GetPictureInPictureOptions() const {}

int TestWebContents::AddPrerender(const GURL& url) {}

TestRenderFrameHost* TestWebContents::AddPrerenderAndCommitNavigation(
    const GURL& url) {}

std::unique_ptr<NavigationSimulator>
TestWebContents::AddPrerenderAndStartNavigation(const GURL& url) {}

void TestWebContents::ActivatePrerenderedPage(const GURL& url) {}

void TestWebContents::ActivatePrerenderedPageFromAddressBar(const GURL& url) {}

base::TimeTicks TestWebContents::GetTabSwitchStartTime() {}

void TestWebContents::SetPictureInPictureOptions(
    std::optional<blink::mojom::PictureInPictureWindowOptions> options) {}

void TestWebContents::SetOverscrollNavigationEnabled(bool enabled) {}

bool TestWebContents::GetOverscrollNavigationEnabled() {}

void TestWebContents::SetSafeAreaInsetsHost(
    std::unique_ptr<SafeAreaInsetsHost> safe_area_insets_host) {}

void TestWebContents::GetMediaCaptureRawDeviceIdsOpened(
    blink::mojom::MediaStreamType type,
    base::OnceCallback<void(std::vector<std::string>)> callback) {}

void TestWebContents::SetMediaCaptureRawDeviceIdsOpened(
    blink::mojom::MediaStreamType type,
    std::vector<std::string> ids) {}

}  // namespace content