#include "content/public/test/render_view_test.h"
#include <stddef.h>
#include <optional>
#include <string_view>
#include <tuple>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/escape.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "cc/test/test_task_graph_runner.h"
#include "components/input/native_web_keyboard_event.h"
#include "content/app/mojo/mojo_init.h"
#include "content/common/agent_scheduling_group.mojom.h"
#include "content/common/frame.mojom.h"
#include "content/common/renderer.mojom.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/test/content_test_suite_base.h"
#include "content/public/test/fake_render_widget_host.h"
#include "content/public/test/frame_load_waiter.h"
#include "content/public/test/policy_container_utils.h"
#include "content/renderer/mock_agent_scheduling_group.h"
#include "content/renderer/render_process.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/renderer_blink_platform_impl.h"
#include "content/renderer/renderer_main_platform_delegate.h"
#include "content/test/test_content_client.h"
#include "content/test/test_render_frame.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "third_party/blink/public/common/dom_storage/session_storage_namespace_id.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/navigation/navigation_params.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
#include "third_party/blink/public/common/widget/visual_properties.h"
#include "third_party/blink/public/mojom/frame/frame_replication_state.mojom.h"
#include "third_party/blink/public/mojom/leak_detector/leak_detector.mojom.h"
#include "third_party/blink/public/mojom/navigation/navigation_params.mojom.h"
#include "third_party/blink/public/mojom/page/browsing_context_group_info.mojom.h"
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/platform/web_url_request_extra_data.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_history_item.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_v8_features.h"
#include "third_party/blink/public/web/web_view.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_manager.h"
#include "ui/color/color_provider_source.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/native_theme/native_theme_features.h"
#include "v8/include/v8.h"
#if BUILDFLAG(IS_MAC)
#include "base/apple/scoped_nsautorelease_pool.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.h"
#include "content/test/dwrite_font_fake_sender_win.h"
#endif
WebGestureEvent;
WebInputEvent;
WebLocalFrame;
WebMouseEvent;
WebScriptSource;
WebString;
WebURLRequest;
namespace content {
namespace {
class FailingURLLoaderFactory : public network::SharedURLLoaderFactory { … };
class MockColorProviderSource : public ui::ColorProviderSource { … };
bool GetWindowsKeyCode(char ascii_character, int* key_code) { … }
}
class RendererBlinkPlatformImplTestOverrideImpl
: public RendererBlinkPlatformImpl { … };
class RenderFrameWasShownWaiter : public RenderFrameObserver { … };
RenderViewTest::RendererBlinkPlatformImplTestOverride::
RendererBlinkPlatformImplTestOverride() { … }
RenderViewTest::RendererBlinkPlatformImplTestOverride::
~RendererBlinkPlatformImplTestOverride() = default;
RendererBlinkPlatformImpl*
RenderViewTest::RendererBlinkPlatformImplTestOverride::Get() const { … }
void RenderViewTest::RendererBlinkPlatformImplTestOverride::Initialize() { … }
void RenderViewTest::RendererBlinkPlatformImplTestOverride::Shutdown() { … }
RenderViewTest::RenderViewTest(bool hook_render_frame_creation)
: … { … }
RenderViewTest::~RenderViewTest() = default;
WebLocalFrame* RenderViewTest::GetMainFrame() { … }
RenderFrame* RenderViewTest::GetMainRenderFrame() { … }
v8::Isolate* RenderViewTest::Isolate() { … }
void RenderViewTest::ExecuteJavaScriptForTests(std::string_view js) { … }
bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue(
const std::u16string& script,
int* int_result) { … }
bool RenderViewTest::ExecuteJavaScriptAndReturnNumberValue(
const std::u16string& script,
double* number_result) { … }
void RenderViewTest::LoadHTML(std::string_view html) { … }
void RenderViewTest::LoadHTMLWithUrlOverride(std::string_view html,
std::string_view url_override) { … }
blink::PageState RenderViewTest::GetCurrentPageState() { … }
void RenderViewTest::GoBack(const GURL& url, const blink::PageState& state) { … }
void RenderViewTest::GoForward(const GURL& url, const blink::PageState& state) { … }
void RenderViewTest::SetUp() { … }
void RenderViewTest::TearDown() { … }
void RenderViewTest::SendNativeKeyEvent(
const input::NativeWebKeyboardEvent& key_event) { … }
void RenderViewTest::SendInputEvent(const blink::WebInputEvent& input_event) { … }
void RenderViewTest::SendWebKeyboardEvent(
const blink::WebKeyboardEvent& key_event) { … }
void RenderViewTest::SendWebMouseEvent(
const blink::WebMouseEvent& mouse_event) { … }
void RenderViewTest::SendWebGestureEvent(
const blink::WebGestureEvent& gesture_event) { … }
gfx::Rect RenderViewTest::GetElementBounds(const std::string& element_id) { … }
bool RenderViewTest::SimulateElementClick(const std::string& element_id) { … }
void RenderViewTest::SimulatePointClick(const gfx::Point& point) { … }
bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) { … }
void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) { … }
void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) { … }
void RenderViewTest::SetFocused(const blink::WebElement& element) { … }
void RenderViewTest::ChangeFocusToNull(const blink::WebDocument& document) { … }
void RenderViewTest::Reload(const GURL& url) { … }
void RenderViewTest::Resize(gfx::Size new_size, bool is_fullscreen_granted) { … }
void RenderViewTest::SimulateUserTypingASCIICharacter(char ascii_character,
bool flush_message_loop) { … }
void RenderViewTest::SimulateUserInputChangeForElement(
blink::WebInputElement* input,
const std::string& new_value) { … }
void RenderViewTest::OnSameDocumentNavigation(blink::WebLocalFrame* frame,
bool is_new_navigation) { … }
blink::WebFrameWidget* RenderViewTest::GetWebFrameWidget() { … }
ContentClient* RenderViewTest::CreateContentClient() { … }
ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() { … }
ContentRendererClient* RenderViewTest::CreateContentRendererClient() { … }
std::unique_ptr<FakeRenderWidgetHost> RenderViewTest::CreateRenderWidgetHost() { … }
blink::VisualProperties RenderViewTest::InitialVisualProperties() { … }
void RenderViewTest::GoToOffset(int offset,
const GURL& url,
const blink::PageState& state) { … }
void RenderViewTest::CreateFakeURLLoaderFactory() { … }
}