chromium/chrome/browser/apps/guest_view/web_view_browsertest.cc

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

#include <memory>
#include <set>
#include <utility>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/run_until.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/test_timeouts.h"
#include "base/threading/thread_restrictions.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/hid/chrome_hid_delegate.h"
#include "chrome/browser/hid/hid_chooser_context.h"
#include "chrome/browser/hid/hid_chooser_context_factory.h"
#include "chrome/browser/lifetime/application_lifetime_desktop.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/profile_network_context_service_factory.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_link_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
#include "chrome/browser/task_manager/task_manager_browsertest_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/hid/hid_chooser_controller.h"
#include "chrome/browser/ui/login/login_handler.h"
#include "chrome/browser/usb/usb_browser_test_utils.h"
#include "chrome/browser/usb/usb_chooser_context.h"
#include "chrome/browser/usb/usb_chooser_context_factory.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/download/public/common/download_task_runner.h"
#include "components/find_in_page/find_tab_helper.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/guest_view/browser/guest_view_manager_delegate.h"
#include "components/guest_view/browser/guest_view_manager_factory.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_link_manager.h"
#include "components/permissions/mock_chooser_controller_view.h"
#include "components/permissions/test/mock_permission_prompt_factory.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/browser/db/fake_database_manager.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "components/version_info/channel.h"
#include "components/version_info/version_info.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/hid_chooser.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_process_host_creation_observer.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/content_mock_cert_verifier.h"
#include "content/public/test/download_test_observer.h"
#include "content/public/test/fake_speech_recognition_manager.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/public/test/find_test_utils.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/no_renderer_crashes_assertion.h"
#include "content/public/test/scoped_accessibility_mode_override.h"
#include "content/public/test/test_file_error_injector.h"
#include "content/public/test/test_frame_navigation_observer.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "extensions/browser/api/declarative/rules_cache_delegate.h"
#include "extensions/browser/api/declarative/rules_registry.h"
#include "extensions/browser/api/declarative/rules_registry_service.h"
#include "extensions/browser/api/declarative/test_rules_registry.h"
#include "extensions/browser/api/declarative_webrequest/webrequest_constants.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/browser/process_map.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/test/extension_test_message_listener.h"
#include "media/base/media_switches.h"
#include "net/dns/mock_host_resolver.h"
#include "net/ssl/client_cert_identity_test_util.h"
#include "net/ssl/client_cert_store.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/test_data_directory.h"
#include "pdf/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/device/public/cpp/test/fake_hid_manager.h"
#include "services/device/public/cpp/test/fake_usb_device_manager.h"
#include "services/device/public/cpp/test/scoped_geolocation_overrider.h"
#include "services/device/public/mojom/hid.mojom.h"
#include "services/network/public/cpp/network_switches.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/switches.h"
#include "ui/accessibility/ax_mode.h"
#include "ui/accessibility/ax_updates_and_events.h"
#include "ui/display/display_switches.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#include "ui/gfx/geometry/point.h"
#include "ui/latency/latency_info.h"
#include "url/url_constants.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "ash/webui/settings/public/constants/routes.mojom.h"  // nogncheck
#include "chrome/browser/ash/system_web_apps/system_web_app_manager.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/extensions/extension_keeplist_chromeos.h"
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

#if defined(USE_AURA)
#include "ui/aura/env.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/window.h"
#endif

#if BUILDFLAG(ENABLE_PPAPI)
#include "content/public/test/ppapi_test_utils.h"
#endif

#if BUILDFLAG(ENABLE_PDF)
#include "base/test/with_feature_override.h"
#include "chrome/browser/pdf/pdf_extension_test_util.h"
#include "chrome/browser/pdf/test_pdf_viewer_stream_manager.h"
#include "pdf/pdf_features.h"
#endif  // BUILDFLAG(ENABLE_PDF)

ContextMenuMatcher;
ExtensionsAPIClient;
MenuItem;
GuestViewManager;
TestGuestViewManager;
TestGuestViewManagerFactory;
NoStatePrefetchLinkManager;
NoStatePrefetchLinkManagerFactory;
MatchAboutBlankTab;
MatchAnyApp;
MatchAnyBackground;
MatchAnyTab;
MatchAnyWebView;
MatchApp;
MatchBackground;
MatchWebView;
WaitForTaskManagerRows;
MenuModel;

namespace {
const char kEmptyResponsePath[] =;
const char kRedirectResponsePath[] =;
const char kUserAgentRedirectResponsePath[] =;
const char kCacheResponsePath[] =;
const char kRedirectResponseFullPath[] =;

class RenderWidgetHostVisibilityObserver
    : public content::RenderWidgetHostObserver {};

// Watches for context menu to be shown, sets a boolean if it is shown.
class ContextMenuShownObserver {};

class EmbedderWebContentsObserver : public content::WebContentsObserver {};

void ExecuteScriptWaitForTitle(content::WebContents* web_contents,
                               const char* script,
                               const char* title) {}

#if defined(USE_AURA)
// Waits for select control shown/closed.
class SelectControlWaiter : public aura::WindowObserver,
                            public aura::EnvObserver {};

// Simulate real click with delay between mouse down and up.
class LeftMouseClick {};

#endif

bool IsShowingInterstitial(content::WebContents* tab) {}

// Wraps around the browser-initiated |NavigateToURL| to hide direct guest
// WebContents access. For MPArch GuestView migration pre-work, we do not have
// such a mechanism to trigger a browser-initiated navigation on GuestView or
// guest RenderFrameHost.
[[nodiscard]] bool BrowserInitNavigationToUrl(guest_view::GuestViewBase* guest,
                                              const GURL& url) {}

}  // namespace

// This class intercepts media access request from the embedder. The request
// should be triggered only if the embedder API (from tests) allows the request
// in Javascript.
// We do not issue the actual media request; the fact that the request reached
// embedder's WebContents is good enough for our tests. This is also to make
// the test run successfully on trybots.
class MockWebContentsDelegate : public content::WebContentsDelegate {};

// This class intercepts download request from the guest.
class MockDownloadWebContentsDelegate : public content::WebContentsDelegate {};

class WebViewTest : public extensions::PlatformAppBrowserTest {};

// The following test suites are created to group tests based on specific
// features of <webview>.
WebViewSizeTest;
WebViewVisibilityTest;
WebViewSpeechAPITest;
WebViewAccessibilityTest;
WebViewNewWindowTest;

class WebViewDPITest : public WebViewTest {};

class WebContentsAudioMutedObserver : public content::WebContentsObserver {};

class IsAudibleObserver : public content::WebContentsObserver {};

IN_PROC_BROWSER_TEST_F(WebViewTest, AudibilityStatePropagates) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, SetAudioMuted) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, WebViewRespectsInsets) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, AudioMutesWhileAttached) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, AudioMutesOnAttach) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, AudioStateJavascriptAPI) {}

// Test that WebView does not override autoplay policy.
IN_PROC_BROWSER_TEST_F(WebViewTest, AutoplayPolicy) {}

// This test exercises the webview spatial navigation API
// TODO(crbug.com/41493388): Flaky timeouts on Mac and Cros.
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)
#define MAYBE_SpatialNavigationJavascriptAPI
#else
#define MAYBE_SpatialNavigationJavascriptAPI
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_SpatialNavigationJavascriptAPI) {}

// This test verifies that hiding the guest triggers visibility change
// notifications.
IN_PROC_BROWSER_TEST_F(WebViewVisibilityTest, GuestVisibilityChanged) {}

// This test verifies that hiding the embedder also hides the guest.
IN_PROC_BROWSER_TEST_F(WebViewVisibilityTest, EmbedderVisibilityChanged) {}

// This test verifies that reloading the embedder reloads the guest (and doest
// not crash).
IN_PROC_BROWSER_TEST_F(WebViewTest, ReloadEmbedder) {}

// This test ensures JavaScript errors ("Cannot redefine property") do not
// happen when a <webview> is removed from DOM and added back.
IN_PROC_BROWSER_TEST_F(WebViewTest, AddRemoveWebView_AddRemoveWebView) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, AutoSize) {}

// Test for http://crbug.com/419611.
IN_PROC_BROWSER_TEST_F(WebViewTest, DisplayNoneSetSrc) {}

// Checks that {allFrames: true} injects script correctly to subframes
// inside <webview>.
IN_PROC_BROWSER_TEST_F(WebViewTest, ExecuteScript) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ExecuteCode) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestAutosizeAfterNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAllowTransparencyAttribute) {}

IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeHeight) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestAutosizeHeight) {}

IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeBeforeNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestAutosizeBeforeNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewDPITest, Shim_TestAutosizeRemoveAttributes) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestAutosizeRemoveAttributes) {}

// This test is disabled due to being flaky. http://crbug.com/282116
IN_PROC_BROWSER_TEST_F(WebViewSizeTest,
                       DISABLED_Shim_TestAutosizeWithPartialAttributes) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestCustomElementCallbacksInaccessible) {}

// Tests the existence of WebRequest API event objects on the request
// object, on the webview element, and hanging directly off webview.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) {}

// Tests that addListener call succeeds on webview's WebRequest API events.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIAddListener) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIErrorOccurred) {}

#if defined(USE_AURA)
// Test validates that select tag can be shown and hidden in webview safely
// using quick touch.
IN_PROC_BROWSER_TEST_F(WebViewTest, SelectShowHide) {}
#endif

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestChromeExtensionURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestChromeExtensionRelativePath) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestContentInitiatedNavigationToDataUrlBlocked) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDisplayNoneWebviewLoad) {}

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
    BUILDFLAG(IS_MAC)
#define MAYBE_Shim_TestDisplayNoneWebviewRemoveChild
#else
#define MAYBE_Shim_TestDisplayNoneWebviewRemoveChild
#endif
// Flaky on most desktop platforms: https://crbug.com/1115106.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       MAYBE_Shim_TestDisplayNoneWebviewRemoveChild) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDisplayBlock) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestInlineScriptFromAccessibleResources) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestInvalidChromeExtensionURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestEventName) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestOnEventProperty) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadProgressEvent) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDestroyOnEventListener) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCannotMutateEventName) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestPartitionChangeAfterNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestPartitionRemovalAfterNavigationFails) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAddContentScript) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAddMultipleContentScripts) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestAddContentScriptWithSameNameShouldOverwriteTheExistingOne) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestAddContentScriptToOneWebViewShouldNotInjectToTheOtherWebView) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAddAndRemoveContentScripts) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       Shim_TestAddContentScriptsWithNewWindowAPI) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestContentScriptIsInjectedAfterTerminateAndReloadWebView) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestContentScriptExistsAsLongAsWebViewTagExists) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAddContentScriptWithCode) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestAddMultipleContentScriptsWithCodeAndCheckGeneratedScriptUrl) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScriptFail) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScript) {}

// Flaky and likely not testing the right assertion. https://crbug.com/703727
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    DISABLED_Shim_TestExecuteScriptIsAbortedWhenWebViewSourceIsChanged) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestExecuteScriptIsAbortedWhenWebViewSourceIsInvalid) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestTerminateAfterExit) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAssignSrcAfterCrash) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestNavOnConsecutiveSrcAttributeChanges) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavOnSrcAttributeChange) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavigateAfterResize) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNestedCrossOriginSubframes) {}

#if BUILDFLAG(IS_MAC)
// Flaky on Mac. See https://crbug.com/674904.
#define MAYBE_Shim_TestNestedSubframes
#else
#define MAYBE_Shim_TestNestedSubframes
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Shim_TestNestedSubframes) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveSrcAttribute) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReassignSrcAttribute) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, Shim_TestNewWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, Shim_TestNewWindowTwoListeners) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       Shim_TestNewWindowNoPreventDefault) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, Shim_TestNewWindowNoReferrerLink) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       Shim_TestWebViewAndEmbedderInNewWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       Shim_TestWebViewAndEmbedderInNewWindow_Noopener) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       Shim_TestNewWindowAttachToExisting) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, Shim_TestNewWindowNoDeadlock) {}

// This is a regression test for crbug.com/1309302. It launches an app
// with two iframes and a webview within each of the iframes. The
// purpose of the test is to ensure that webRequest subevent names are
// unique across all webviews within the app.
IN_PROC_BROWSER_TEST_F(WebViewTest, TwoIframesWebRequest) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_AttachAfterOpenerDestroyed) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_AttachInSubFrame) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_NewWindowNameTakesPrecedence) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_WebViewNameTakesPrecedence) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_NoName) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_Redirect) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_Close) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_DeferredAttachment) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_ExecuteScript) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_DeclarativeWebRequest) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_DiscardAfterOpenerDestroyed) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_WebRequest) {}

// A custom elements bug needs to be addressed to enable this test:
// See http://crbug.com/282477 for more information.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       DISABLED_NewWindow_WebRequestCloseWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_WebRequestRemoveElement) {}

// Ensure that when one <webview> makes a window.open() call that references
// another <webview> by name, the opener is updated without a crash. Regression
// test for https://crbug.com/1013553.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, NewWindow_UpdateOpener) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_OpenerDestroyedWhileUnattached) {}

// Creates a guest in a unattached state, then confirms that calling
// |RenderFrameHost::ForEachRenderFrameHost| on the embedder will include the
// guest's frame.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_UnattachedVisitedByForEachRenderFrameHost) {}

// Creates a guest in a unattached state, then confirms that calling
// the various view methods return null.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_UnattachedVerifyViewMethods) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestContentLoadEvent) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestContentLoadEventWithDisplayNone) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDeclarativeWebRequestAPI) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestDeclarativeWebRequestAPISendMessage) {}

IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    Shim_TestDeclarativeWebRequestAPISendMessageSecondWebView) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPI) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIOnlyForInstance) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIWithHeaders) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIGoogleProperty) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestWebRequestListenerSurvivesReparenting) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadStartLoadRedirect) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestLoadAbortChromeExtensionURLWrongPartition) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortEmptyResponse) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalChromeURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalFileURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalJavaScriptURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortInvalidNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortNonWebSafeScheme) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReload) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReloadAfterTerminate) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGetProcessId) {}

IN_PROC_BROWSER_TEST_F(WebViewVisibilityTest, Shim_TestHiddenBeforeNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) {}

// Remove <webview> immediately after navigating it.
// This is a regression test for http://crbug.com/276023.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewAfterNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNavigationToExternalProtocol) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest,
                       Shim_TestResizeWebviewWithDisplayNoneResizesContent) {}

IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestResizeWebviewResizesContent) {}

class WebViewSSLErrorTest : public WebViewTest {};

// Test makes sure that an interstitial is shown in `<webview>` with an SSL
// error.
// Flaky on Win dbg: crbug.com/779973
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_ShowInterstitialForSSLError
#else
#define MAYBE_ShowInterstitialForSSLError
#endif
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, MAYBE_ShowInterstitialForSSLError) {}

// Ensure that when a guest is created and navigated to a URL that triggers an
// SSL interstitial, and then the "Back to safety" button is activated on the
// interstitial, the guest doesn't crash trying to load the NTP (the usual
// known-safe page used to navigate back from such interstitials when there's
// no other page in history to go to).  See https://crbug.com/1444221.
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, NavigateBackFromSSLError) {}

// Test makes sure that the interstitial is registered in the
// `RenderWidgetHostInputEventRouter` when inside a `<webview>`.
// Flaky on Win dbg: crbug.com/779973
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_InterstitialPageRouteEvents
#else
#define MAYBE_InterstitialPageRouteEvents
#endif
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, MAYBE_InterstitialPageRouteEvents) {}

// Test makes sure that the browser does not crash when a `<webview>` navigates
// out of an interstitial caused by a SSL error.
// Flaky on Win dbg: crbug.com/779973
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_InterstitialPageDetach
#else
#define MAYBE_InterstitialPageDetach
#endif
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, MAYBE_InterstitialPageDetach) {}

// This test makes sure the browser process does not crash if app is closed
// while an interstitial is being shown in guest.
// Flaky on Win dbg: crbug.com/779973
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_InterstitialTearDown
#else
#define MAYBE_InterstitialTearDown
#endif
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, MAYBE_InterstitialTearDown) {}

// This test makes sure the browser process does not crash if browser is shut
// down while an interstitial is being shown in guest.
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest,
                       InterstitialTearDownOnBrowserShutdown) {}

// This allows us to specify URLs which trigger Safe Browsing.
class WebViewSafeBrowsingTest : public WebViewTest {};

IN_PROC_BROWSER_TEST_F(WebViewSafeBrowsingTest,
                       Shim_TestLoadAbortSafeBrowsing) {}

// Tests that loading an HTTPS page in a guest <webview> with HTTPS-First Mode
// enabled doesn't crash nor shows error page.
// Regression test for crbug.com/1233889
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, GuestLoadsHttpsWithoutError) {}

// Tests that loading an HTTP page in a guest <webview> with HTTPS-First Mode
// enabled doesn't crash and doesn't trigger the error page.
IN_PROC_BROWSER_TEST_F(WebViewSSLErrorTest, GuestLoadsHttpWithoutError) {}

// Verify that guests cannot be navigated to disallowed URLs, such as
// chrome:// URLs, directly via the content/public API.  The enforcement for
// this typically happens in the embedder layer, catching cases where the
// embedder navigates a guest, but Chrome features could bypass that
// enforcement by directly navigating guests.  This test verifies that if that
// were to happen, //content would still gracefully disallow attempts to load
// disallowed URLs in guests without crashing.
IN_PROC_BROWSER_TEST_F(WebViewTest, CannotNavigateGuestToChromeURL) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) {}

// This test verifies that prerendering has been disabled inside <webview>.
// This test is here rather than in PrerenderBrowserTest for testing convenience
// only. If it breaks then this is a bug in the prerenderer.
IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) {}

// Verify that existing <webview>'s are detected when the task manager starts
// up.
IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagerExistingWebView) {}

// Verify that the task manager notices the creation of new <webview>'s.
IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagerNewWebView) {}

// This tests cookie isolation for packaged apps with webview tags. It navigates
// the main browser window to a page that sets a cookie and loads an app with
// multiple webview tags. Each tag sets a cookie and the test checks the proper
// storage isolation is enforced.
IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) {}

// This tests that in-memory storage partitions are reset on browser restart,
// but persistent ones maintain state for cookies and HTML5 storage.
IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) {}

// This is the post-reset portion of the StoragePersistence test.  See
// PRE_StoragePersistence for main comment.
IN_PROC_BROWSER_TEST_F(WebViewTest, StoragePersistence) {}

// This tests DOM storage isolation for packaged apps with webview tags. It
// loads an app with multiple webview tags and each tag sets DOM storage
// entries, which the test checks to ensure proper storage isolation is
// enforced.
IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) {}

// This tests how guestviews should or should not be able to find each other
// depending on whether they are in the same storage partition or not.
// This is a regression test for https://crbug.com/794079 (where two guestviews
// in the same storage partition stopped being able to find each other).
// This is also a regression test for https://crbug.com/802278 (setting of
// a guestview as an opener should not leak any memory).
IN_PROC_BROWSER_TEST_F(WebViewTest, FindabilityIsolation) {}

// This tests IndexedDB isolation for packaged apps with webview tags. It loads
// an app with multiple webview tags and each tag creates an IndexedDB record,
// which the test checks to ensure proper storage isolation is enforced.
IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) {}

// This test ensures that closing app window on 'loadcommit' does not crash.
// The test launches an app with guest and closes the window on loadcommit. It
// then launches the app window again. The process is repeated 3 times.
// TODO(crbug.com/40621838): The test is flaky (crash) on ChromeOS debug and
// ASan/LSan
#if BUILDFLAG(IS_CHROMEOS_ASH) && \
    (!defined(NDEBUG) || defined(ADDRESS_SANITIZER))
#define MAYBE_CloseOnLoadcommit
#else
#define MAYBE_CloseOnLoadcommit
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_CloseOnLoadcommit) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIDeny_TestDeny) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       MediaAccessAPIDeny_TestDenyThenAllowThrows) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       MediaAccessAPIDeny_TestDenyWithPreventDefault) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       MediaAccessAPIDeny_TestNoListenersImplyDeny) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       MediaAccessAPIDeny_TestNoPreventDefaultImpliesDeny) {}

void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Abort) {}

// A navigation to a web-safe URL should succeed, even if it is not renderer-
// initiated, such as a navigation from the PDF viewer.
IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {}

IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {}

// Verify that we handle gracefully having two webviews in the same
// BrowsingInstance with COOP values that would normally make it impossible
// (meaning outside of webviews special case) to group them together.
// This is a regression test for https://crbug.com/1243711.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest,
                       NewWindow_DifferentCoopStatesInRelatedWebviews) {}

// This test creates a situation where we have two unattached webviews which
// have an opener relationship, and ensures that we can shutdown safely. See
// https://crbug.com/1450397.
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, DestroyOpenerBeforeAttachment) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ContextMenuInspectElement) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
class WebViewSettingsRevampTest : public WebViewTest,
                                  public testing::WithParamInterface<bool> {
 public:
  WebViewSettingsRevampTest() {
    scoped_feature_list_.InitWithFeatureState(
        ash::features::kOsSettingsRevampWayfinding,
        /*enabled=*/GetParam());
  }
  ~WebViewSettingsRevampTest() override = default;

  static std::string DescribeParams(
      const testing::TestParamInfo<ParamType>& info) {
    return info.param ? "OsSettingsRevampWayfindingEnabled"
                      : "OsSettingsRevampWayfindingDisabled";
  }

 private:
  base::test::ScopedFeatureList scoped_feature_list_;
};

INSTANTIATE_TEST_SUITE_P(WebViewTests,
                         WebViewSettingsRevampTest,
                         testing::Bool(),
                         WebViewSettingsRevampTest::DescribeParams);
#endif

// This test executes the context menu command 'LanguageSettings'.
// On Ash, this will open the language settings in the OS Settings app.
// Elsewhere, it will load chrome://settings/languages in a browser window.
// In either case, this is a browser-initiated operation and so we expect it
// to succeed if the embedder is allowed to perform the operation.
#if BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(WebViewSettingsRevampTest, ContextMenuLanguageSettings) {
#else
IN_PROC_BROWSER_TEST_F(WebViewTest, ContextMenuLanguageSettings) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ContextMenusAPI_Basic) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ContextMenusAPI_PreventDefault) {}

// Tests that a context menu is created when right-clicking in the webview. This
// also tests that the 'contextmenu' event is handled correctly.
IN_PROC_BROWSER_TEST_F(WebViewTest, TestContextMenu) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAndThenDeny) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowTwice) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAsync) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestCheck) {}

// Checks that window.screenX/screenY/screenLeft/screenTop works correctly for
// guests.
IN_PROC_BROWSER_TEST_F(WebViewTest, ScreenCoordinates) {}

// TODO(crbug.com/40677344): This test leaks memory.
#if defined(LEAK_SANITIZER)
#define MAYBE_TearDownTest
#else
#define MAYBE_TearDownTest
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) {}

// Tests that an app can inject a content script into a webview, and that it can
// send cross-origin requests with CORS headers.
IN_PROC_BROWSER_TEST_F(WebViewTest, ContentScriptFetch) {}

// In following GeolocationAPIEmbedderHasNoAccess* tests, embedder (i.e. the
// platform app) does not have geolocation permission for this test.
// No matter what the API does, geolocation permission would be denied.
// Note that the test name prefix must be "GeolocationAPI".
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessAllow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessDeny) {}

// In following GeolocationAPIEmbedderHasAccess* tests, embedder (i.e. the
// platform app) has geolocation permission
//
// Note that these are run separately because OverrideGeolocation() doesn't
// mock out geolocation for multiple navigator.geolocation calls properly and
// the tests become flaky.
//
// GeolocationAPI* test 1 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessAllow) {}

// GeolocationAPI* test 2 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessDeny) {}

// GeolocationAPI* test 3 of 3.
// Currently disabled until crbug.com/526788 is fixed.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       GeolocationAPIEmbedderHasAccessMultipleBridgeIdAllow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasAccessAllowGeolocation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasAccessDenyGeolocation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasAccessAllowCamera) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, PermissionsAPIEmbedderHasAccessDenyCamera) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasAccessAllowMicrophone) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasAccessDenyMicrophone) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, PermissionsAPIEmbedderHasAccessAllowMedia) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, PermissionsAPIEmbedderHasAccessDenyMedia) {}

class MockHidDelegate : public ChromeHidDelegate {};

class WebHidWebViewTest : public WebViewTest {};

IN_PROC_BROWSER_TEST_F(WebHidWebViewTest,
                       PermissionsAPIEmbedderHasAccessAllowHid) {}

IN_PROC_BROWSER_TEST_F(WebHidWebViewTest,
                       PermissionsAPIEmbedderHasAccessDenyHid) {}

// Tests that closing the app window before the HID request is answered will
// work correctly. This is meant to verify that no mojo callbacks will be
// dropped in such case.
IN_PROC_BROWSER_TEST_F(WebHidWebViewTest,
                       PermissionsAPIEmbedderHasAccessCloseWindowHid) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessAllowGeolocation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessDenyGeolocation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessAllowCamera) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessDenyCamera) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessAllowMicrophone) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessDenyMicrophone) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessAllowMedia) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       PermissionsAPIEmbedderHasNoAccessDenyMedia) {}

// Tests that
// BrowserPluginGeolocationPermissionContext::CancelGeolocationPermissionRequest
// is handled correctly (and does not crash).
IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPICancelGeolocation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_GeolocationRequestGone) {}

// In following FilesystemAPIRequestFromMainThread* tests, guest request
// filesystem access from main thread of the guest.
// FileSystemAPIRequestFromMainThread* test 1 of 3
IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromMainThreadAllow) {}

// FileSystemAPIRequestFromMainThread* test 2 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromMainThreadDeny) {}

// FileSystemAPIRequestFromMainThread* test 3 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       FileSystemAPIRequestFromMainThreadDefaultAllow) {}

// In following FilesystemAPIRequestFromWorker* tests, guest create a worker
// to request filesystem access from worker thread.
// FileSystemAPIRequestFromWorker* test 1 of 3
IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromWorkerAllow) {}

// FileSystemAPIRequestFromWorker* test 2 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest, FileSystemAPIRequestFromWorkerDeny) {}

// FileSystemAPIRequestFromWorker* test 3 of 3.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       FileSystemAPIRequestFromWorkerDefaultAllow) {}

// In following FilesystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* tests,
// embedder contains a single webview guest. The guest creates a shared worker
// to request filesystem access from worker thread.
// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 1 of 3
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestAllow) {}

// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 2 of 3.
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDeny) {}

// FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 3 of 3.
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDefaultAllow) {}

// In following FilesystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* tests,
// embedder contains mutiple webview guests. Each guest creates a shared worker
// to request filesystem access from worker thread.
// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 1 of 3
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsAllow) {}

// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 2 of 3.
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDeny) {}

// FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 3 of 3.
IN_PROC_BROWSER_TEST_F(
    WebViewTest,
    FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDefaultAllow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ClearData) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ClearSessionCookies) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ClearPersistentCookies) {}

// Regression test for https://crbug.com/615429.
IN_PROC_BROWSER_TEST_F(WebViewTest, ClearDataTwice) {}

#if BUILDFLAG(IS_WIN)
// Test is disabled on Windows because it fails often (~9% time)
// http://crbug.com/489088
#define MAYBE_ClearDataCache
#else
#define MAYBE_ClearDataCache
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_ClearDataCache) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, ConsoleMessage) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadPermission) {}

namespace {

const char kDownloadPathPrefix[] =;

// EmbeddedTestServer request handler for use with DownloadCookieIsolation test.
// Responds with the next status code 200 if the 'Cookie' header sent with the
// request matches the query() part of the URL. Otherwise, fails the request
// with an HTTP 403. The body of the response is the value of the Cookie
// header.
std::unique_ptr<net::test_server::HttpResponse> HandleDownloadRequestWithCookie(
    const net::test_server::HttpRequest& request) {}

// Class for waiting for download manager to be initiailized.
class DownloadManagerWaiter : public content::DownloadManager::Observer {};

}  // namespace

// Downloads initiated from isolated guest parititons should use their
// respective cookie stores. In addition, if those downloads are resumed, they
// should continue to use their respective cookie stores.
IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadCookieIsolation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_DownloadCookieIsolation_CrossSession) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadCookieIsolation_CrossSession) {}

// This test makes sure loading <webview> does not crash when there is an
// extension which has content script allowlisted/forced.
IN_PROC_BROWSER_TEST_F(WebViewTest, AllowlistedContentScript) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, SendMessageToExtensionFromGuest) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, SendMessageToComponentExtensionFromGuest) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentInteractive) {}

IN_PROC_BROWSER_TEST_F(WebViewSpeechAPITest,
                       SpeechRecognitionAPI_HasPermissionAllow) {}

IN_PROC_BROWSER_TEST_F(WebViewSpeechAPITest,
                       SpeechRecognitionAPI_HasPermissionDeny) {}

IN_PROC_BROWSER_TEST_F(WebViewSpeechAPITest,
                       SpeechRecognitionAPI_NoPermission) {}

// Tests overriding user agent.
IN_PROC_BROWSER_TEST_F(WebViewTest, UserAgent) {}

// TODO(crbug.com/40260430): Test is flaky.
#if BUILDFLAG(IS_MAC)
#define MAYBE_UserAgent_NewWindow
#else
#define MAYBE_UserAgent_NewWindow
#endif
IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, MAYBE_UserAgent_NewWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, NoPermission) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestAlertDialog) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, TestConfirmDialog) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogCancel) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultCancel) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultGCCancel) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, NoContentSettingsAPI) {}

class WebViewCaptureTest : public WebViewTest {};

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestZoomAPI) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAPI) {}

// crbug.com/710486
#if defined(MEMORY_SANITIZER)
#define MAYBE_Shim_TestFindAPI_findupdate
#else
#define MAYBE_Shim_TestFindAPI_findupdate
#endif
IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Shim_TestFindAPI_findupdate) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_testFindInMultipleWebViews) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFindAfterTerminate) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadDataAPI) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadDataAPIAccessibleResources) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, LoadDataAPINotRelativeToAnotherExtension) {}

// This test verifies that the resize and contentResize events work correctly.
IN_PROC_BROWSER_TEST_F(WebViewSizeTest, Shim_TestResizeEvents) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestPerOriginZoomMode) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestPerViewZoomMode) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDisabledZoomMode) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestZoomBeforeNavigation) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, HttpAuth) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, HttpAuthIdentical) {}

namespace {

class NullWebContentsDelegate : public content::WebContentsDelegate {};

// A stub ClientCertStore that returns a FakeClientCertIdentity.
class ClientCertStoreStub : public net::ClientCertStore {};

// static
base::OnceClosure ClientCertStoreStub::quit_closure_;

}  // namespace

class WebViewCertificateSelectorTest : public WebViewTest {};

// Ensure a guest triggering a client certificate dialog does not crash.
IN_PROC_BROWSER_TEST_F(WebViewCertificateSelectorTest,
                       CertificateSelectorForGuest) {}

// Ensure a guest triggering a client certificate dialog does not crash.
// This considers the case where a guest view is in use that has been
// inadvertently broken by misuse of WebContentsDelegates. This has seemingly
// happened multiple times for various dialogs and signin flows (see
// https://crbug.com/1076696 and https://crbug.com/1306988 ), so let's test that
// if we are in this situation, we at least don't crash.
IN_PROC_BROWSER_TEST_F(WebViewCertificateSelectorTest,
                       CertificateSelectorForGuestMisconfigured) {}

// Test fixture to run the test on multiple channels.
class WebViewChannelTest
    : public WebViewTest,
      public testing::WithParamInterface<version_info::Channel> {};

// This test verify that the set of rules registries of a webview will be
// removed from RulesRegistryService after the webview is gone.
// TODO(crbug.com/40231831): The test has the same callstack caused by the race
// with ScopedFeatureList as the issue describes.
#if BUILDFLAG(IS_MAC)
#define MAYBE_Shim_TestRulesRegistryIDAreRemovedAfterWebViewIsGone
#else
#define MAYBE_Shim_TestRulesRegistryIDAreRemovedAfterWebViewIsGone
#endif
IN_PROC_BROWSER_TEST_P(
    WebViewChannelTest,
    MAYBE_Shim_TestRulesRegistryIDAreRemovedAfterWebViewIsGone) {}

IN_PROC_BROWSER_TEST_P(WebViewChannelTest,
                       Shim_WebViewWebRequestRegistryHasNoPersistentCache) {}

INSTANTIATE_TEST_SUITE_P();

// This test verifies that webview.contentWindow works inside an iframe.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebViewInsideFrame) {}

// <webview> screenshot capture fails with ubercomp.
// See http://crbug.com/327035.
IN_PROC_BROWSER_TEST_F(WebViewCaptureTest, DISABLED_Shim_ScreenshotCapture) {}

// Test is disabled because it times out often.
// http://crbug.com/403325
IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_WebViewInBackgroundPage) {}

// This test verifies that the allowtransparency attribute properly propagates.
IN_PROC_BROWSER_TEST_F(WebViewTest, AllowTransparencyAndAllowScalingPropagate) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, BasicPostMessage) {}

// Tests that webviews do get garbage collected.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGarbageCollect) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCloseNewWindowCleanup) {}

// Ensure that focusing a WebView while it is already focused does not blur the
// guest content.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestFocusWhileFocused) {}

#if BUILDFLAG(ENABLE_PDF)
class WebViewPdfTest : public base::test::WithFeatureOverride,
                       public WebViewTest {};

// Test that the PDF viewer has the same bounds as the WebView.
IN_PROC_BROWSER_TEST_P(WebViewPdfTest, PdfContainerBounds) {}

// Test that context menu Back/Forward items in a WebView affect the embedder
// WebContents. See crbug.com/587355.
IN_PROC_BROWSER_TEST_P(WebViewPdfTest, ContextMenuNavigationInWebView) {}

IN_PROC_BROWSER_TEST_P(WebViewPdfTest, Shim_TestDialogInPdf) {}

// TODO(crbug.com/40268279): Stop testing both modes after OOPIF PDF viewer
// launches.
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE();
#endif  // BUILDFLAG(ENABLE_PDF)

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestMailtoLink) {}

// Tests that a renderer navigation from an unattached guest that results in a
// server redirect works properly.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       Shim_TestRendererNavigationRedirectWhileUnattached) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveBeforeAttach) {}

// Tests that the embedder can create a blob URL and navigate a WebView to it.
// See https://crbug.com/652077.
// Also tests that the embedder can't navigate to a blob URL created by a
// WebView. See https://crbug.com/1106890.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestBlobURL) {}

// Tests that no error page is shown when WebRequest blocks a navigation.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestBlockedNavigation) {}

// Tests that a WebView accessible resource can actually be loaded from a
// webpage in a WebView.
IN_PROC_BROWSER_TEST_F(WebViewTest, LoadWebviewAccessibleResource) {}

// Tests that a WebView can be navigated to a WebView accessible resource.
IN_PROC_BROWSER_TEST_F(WebViewTest, NavigateGuestToWebviewAccessibleResource) {}

// Tests that a WebView can reload a WebView accessible resource. See
// https://crbug.com/691941.
IN_PROC_BROWSER_TEST_F(WebViewTest, ReloadWebviewAccessibleResource) {}

IN_PROC_BROWSER_TEST_F(WebViewTest,
                       CookiesEnabledAfterWebviewAccessibleResource) {}

// Tests that webviews cannot embed accessible resources in iframes.
// https://crbug.com/1430991.
IN_PROC_BROWSER_TEST_F(WebViewTest, CannotIframeWebviewAccessibleResource) {}

// Tests that webviews navigated to accessible resources can call certain
// extension APIs.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       CallingExtensionAPIsFromWebviewAccessibleResource) {}

// Tests that a WebView can navigate an iframe to a blob URL that it creates
// while its main frame is at a WebView accessible resource.
IN_PROC_BROWSER_TEST_F(WebViewTest, BlobInWebviewAccessibleResource) {}

// Tests that a WebView cannot load a webview-inaccessible resource. See
// https://crbug.com/640072.
IN_PROC_BROWSER_TEST_F(WebViewTest, LoadWebviewInaccessibleResource) {}

// Ensure that only app resources accessible to the webview can be loaded in a
// webview even if the webview commits an app frame.
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       LoadAccessibleSubresourceInAppWebviewFrame) {}
IN_PROC_BROWSER_TEST_F(WebViewTest,
                       InaccessibleResourceDoesNotLoadInAppWebviewFrame) {}

// Makes sure that a webview will display correctly after reloading it after a
// crash.
// TODO(crbug.com/40286295): Flaky on Win,Mac,ChromeOS,Linux.
IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_ReloadAfterCrash) {}

// The presence of DomAutomationController interferes with these tests, so we
// disable it.
class WebViewTestNoDomAutomationController : public WebViewTest {};

// Tests that a webview inside an iframe can load and that it is destroyed when
// the iframe is detached.
// We need to disable DomAutomationController because it forces the creation of
// a script context. We want to test that we handle the case where there is no
// script context for the iframe. See crbug.com/788914
IN_PROC_BROWSER_TEST_F(WebViewTestNoDomAutomationController,
                       LoadWebviewInsideIframe) {}

IN_PROC_BROWSER_TEST_F(WebViewAccessibilityTest, LoadWebViewAccessibility) {}

IN_PROC_BROWSER_TEST_F(WebViewAccessibilityTest, FocusAccessibility) {}

// Validate that an inner frame within a guest WebContents correctly receives
// focus when requested by accessibility. Previously the root
// BrowserAccessibilityManager would not be updated due to how we were updating
// the AXTreeData.
// The test was disabled. See crbug.com/1141313.
IN_PROC_BROWSER_TEST_F(WebViewAccessibilityTest,
                       DISABLED_FocusAccessibilityNestedFrame) {}

class WebContentsAccessibilityEventWatcher
    : public content::WebContentsObserver {};

IN_PROC_BROWSER_TEST_F(WebViewAccessibilityTest, DISABLED_TouchAccessibility) {}

class WebViewGuestScrollTest : public WebViewTest,
                               public testing::WithParamInterface<bool> {};

class WebViewGuestScrollTouchTest : public WebViewGuestScrollTest {};

// Tests that scrolls bubble from guest to embedder.
// Create two test instances, one where the guest body is scrollable and the
// other where the body is not scrollable: fast-path scrolling will generate
// different ack results in between these two cases.
INSTANTIATE_TEST_SUITE_P();

IN_PROC_BROWSER_TEST_P(WebViewGuestScrollTest, TestGuestWheelScrollsBubble) {}

// Test that when we bubble scroll from a guest, the guest does not also
// consume the scroll.
IN_PROC_BROWSER_TEST_P(WebViewGuestScrollTest,
                       ScrollLatchingPreservedInGuests) {}

INSTANTIATE_TEST_SUITE_P();

IN_PROC_BROWSER_TEST_P(WebViewGuestScrollTouchTest,
                       TestGuestGestureScrollsBubble) {}

// This runs the chrome://chrome-signin page which includes an OOPIF-<webview>
// of accounts.google.com.
class ChromeSignInWebViewTest : public WebViewTest {};

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
// This verifies the fix for http://crbug.com/667708.
IN_PROC_BROWSER_TEST_F(ChromeSignInWebViewTest,
                       ClosingChromeSignInShouldNotCrash) {}
#endif

// This test verifies that unattached guests are not included as the inner
// WebContents. The test verifies this by triggering a find-in-page request on a
// page with both an attached and an unattached <webview> and verifies that,
// unlike the attached guest, no find requests are sent for the unattached
// guest. For more context see https://crbug.com/897465.
// TODO(mcnee): chrome://chrome-signin is not currently supported on Lacros.
// Instead of repurposing existing webui pages to be able to create webviews
// within a tabbed browser, create a dedicated test webui with the necessary
// guest view permissions.
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_NoFindInPageForUnattachedGuest
#else
#define MAYBE_NoFindInPageForUnattachedGuest
#endif
IN_PROC_BROWSER_TEST_F(ChromeSignInWebViewTest,
                       MAYBE_NoFindInPageForUnattachedGuest) {}

// This test class makes "isolated.com" an isolated origin, to be used in
// testing isolated origins inside of a WebView.
class IsolatedOriginWebViewTest : public WebViewTest {};

// Test isolated origins inside a WebView, and make sure that loading an
// isolated origin in a regular tab's subframe doesn't reuse a WebView process
// that had loaded it previously, which would result in renderer kills. See
// https://crbug.com/751916 and https://crbug.com/751920.
IN_PROC_BROWSER_TEST_F(IsolatedOriginWebViewTest, IsolatedOriginInWebview) {}

// This test is similar to IsolatedOriginInWebview above, but loads an isolated
// origin in a <webview> subframe *after* loading the same isolated origin in a
// regular tab's subframe.  The isolated origin's subframe in the <webview>
// subframe should not reuse the regular tab's subframe process.  See
// https://crbug.com/751916 and https://crbug.com/751920.
IN_PROC_BROWSER_TEST_F(IsolatedOriginWebViewTest,
                       LoadIsolatedOriginInWebviewAfterLoadingInRegularTab) {}

// Sends an auto-resize message to the RenderWidgetHost and ensures that the
// auto-resize transaction is handled and produces a single response message
// from guest to embedder.
IN_PROC_BROWSER_TEST_F(WebViewTest, AutoResizeMessages) {}

// Test that a guest sees the synthetic wheel events of a touchpad pinch.
IN_PROC_BROWSER_TEST_F(WebViewTest, TouchpadPinchSyntheticWheelEvents) {}

// Tests that we can open and close a devtools window that inspects a contents
// containing a guest view without crashing.
IN_PROC_BROWSER_TEST_F(WebViewTest, OpenAndCloseDevTools) {}

// Tests that random extensions cannot inject content scripts into a platform
// app's own webview, but the owner platform app can. Regression test for
// crbug.com/1205675.
IN_PROC_BROWSER_TEST_F(WebViewTest, NoExtensionScriptsInjectedInWebview) {}

// Regression test for https://crbug.com/1014385
// We load an extension whose background page attempts to declare variables with
// names that are the same as guest view types. The declarations should not be
// syntax errors.
GuestViewExtensionNameCollisionTest;
IN_PROC_BROWSER_TEST_F(GuestViewExtensionNameCollisionTest,
                       GuestViewNamesDoNotCollideWithExtensions) {}

class PrivateNetworkAccessWebViewTest : public WebViewTest {};

// Verify that Private Network Access has the correct understanding of guests.
// The local/private/public classification should not be affected by being
// within a guest. See https://crbug.com/1167698 for details.
//
// Note: This test is put in this file for convenience of reusing the entire
// app testing infrastructure. Other similar tests that do not require that
// infrastructure live in PrivateNetworkAccessBrowserTest.*
IN_PROC_BROWSER_TEST_F(PrivateNetworkAccessWebViewTest, ClassificationInGuest) {}

// Verify that navigating a <webview> subframe to a disallowed extension
// resource (where the extension ID doesn't match the <webview> owner) doesn't
// result in a renderer kill.  See https://crbug.com/1204094.
IN_PROC_BROWSER_TEST_F(WebViewTest, LoadDisallowedExtensionURLInSubframe) {}

class PopupWaiter : public content::WebContentsObserver {};

// Test destroying an opener webview while the created window has not been
// shown by the renderer. Between the time of the renderer creating and showing
// the new window, the created guest WebContents is owned by content/ and not by
// WebViewGuest. See `WebContentsImpl::pending_contents_` for details. When we
// destroy the new WebViewGuest, content/ must ensure that the guest WebContents
// is destroyed safely.
//
// This test is conceptually similar to
// testNewWindowOpenerDestroyedWhileUnattached, but for this test, we have
// precise timing requirements that need to be controlled by the browser such
// that we shutdown while the new window is pending.
//
// Regression test for https://crbug.com/1442516
IN_PROC_BROWSER_TEST_F(WebViewTest, ShutdownWithUnshownPopup) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, InsertIntoIframe) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, CreateAndInsertInIframe) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, InsertIntoMainFrameFromIframe) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, InsertIntoOtherWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, CreateAndInsertInOtherWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, InsertFromOtherWindow) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, InsertIntoDetachedIframe) {}

// Ensure that if a <webview>'s name is set, the guest preserves the
// corresponding window.name across navigations and after a crash and reload.
IN_PROC_BROWSER_TEST_F(WebViewTest, PreserveNameAcrossNavigationsAndCrashes) {}

#if BUILDFLAG(ENABLE_PPAPI)
class WebViewPPAPITest : public WebViewTest {
 protected:
  void SetUpCommandLine(base::CommandLine* command_line) override {
    WebViewTest::SetUpCommandLine(command_line);
    ASSERT_TRUE(ppapi::RegisterTestPlugin(command_line));
  }
};

IN_PROC_BROWSER_TEST_F(WebViewPPAPITest, Shim_TestPlugin) {
  TestHelper("testPlugin", "web_view/shim", NO_TEST_SERVER);
}

IN_PROC_BROWSER_TEST_F(WebViewPPAPITest, Shim_TestPluginLoadPermission) {
  TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER);
}
#endif  // BUILDFLAG(ENABLE_PPAPI)

// Domain which the Webstore hosted app is associated with in production.
constexpr char kWebstoreURL[] =;
// Domain which the new Webstore is associated with in production.
constexpr char kNewWebstoreURL[] =;
// Domain for testing an overridden Webstore URL.
constexpr char kWebstoreURLOverride[] =;

// Helper class for setting up and testing webview behavior with the Chrome
// Webstore. The test param contains the Webstore URL to test.
class WebstoreWebViewTest : public WebViewTest,
                            public testing::WithParamInterface<GURL> {};

INSTANTIATE_TEST_SUITE_P();

// Ensure that an attempt to load Chrome Web Store in a <webview> is blocked
// and does not result in a renderer kill.  See https://crbug.com/1197674.
IN_PROC_BROWSER_TEST_P(WebstoreWebViewTest, NoRendererKillWithChromeWebStore) {}

// This is a group of tests that check site isolation properties in <webview>
// guests.  Note that site isolation in <webview> is always enabled.
SitePerProcessWebViewTest;

// Checks basic site isolation properties when a <webview> main frame and
// subframe navigate cross-site.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, SimpleNavigations) {}

// Check that site-isolated guests can navigate to error pages.  Due to error
// page isolation, error pages in guests should end up in a new error
// SiteInstance, which should still be a guest SiteInstance in the guest's
// StoragePartition.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, ErrorPageIsolation) {}

// Ensure that the browser doesn't crash when a subframe in a <webview> is
// navigated to an unknown scheme.  This used to be the case due to a mismatch
// between the error page's SiteInstance and the origin to commit as calculated
// in NavigationRequest.  See https://crbug.com/1366450.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, ErrorPageInSubframe) {}

// Checks that a main frame navigation in a <webview> can swap
// BrowsingInstances while staying in the same StoragePartition.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, BrowsingInstanceSwap) {}

// Helper class to count the number of guest processes created.
class GuestProcessCreationObserver
    : public content::RenderProcessHostCreationObserver {};

// Checks that a cross-process navigation in a <webview> does not unnecessarily
// recreate the guest process at OnResponseStarted time.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest,
                       NoExtraGuestProcessAtResponseTime) {}

// Test that both webview-initiated and embedder-initiated navigations to
// about:blank behave sanely.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, NavigateToAboutBlank) {}

// Test that site-isolated <webview> doesn't crash when its initial navigation
// is to an about:blank URL.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, Shim_BlankWebview) {}

// Checks that content scripts work when a <webview> navigates across multiple
// processes.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, ContentScript) {}

// Checks that content scripts work in an out-of-process iframe in a <webview>
// tag.
// TODO(crbug.com/40864752): Fix flakiness on win-rel. The test is also disabled
// on mac11-arm64-rel using filter.
#if BUILDFLAG(IS_WIN)
#define MAYBE_ContentScriptInOOPIF
#else
#define MAYBE_ContentScriptInOOPIF
#endif
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, MAYBE_ContentScriptInOOPIF) {}

// Check that with site-isolated <webview>, two same-site OOPIFs in two
// unrelated <webview> tags share the same process due to the subframe process
// reuse policy.
IN_PROC_BROWSER_TEST_F(SitePerProcessWebViewTest, SubframeProcessReuse) {}

// Helper class to turn off strict site isolation while still using site
// isolation paths for <webview>.  This forces <webview> to use the default
// SiteInstance paths. The helper also defines one isolated origin at
// isolated.com, which takes precedence over the command-line switch to disable
// site isolation and can be used to test a combination of SiteInstances that
// require and don't require dedicated processes.
class WebViewWithDefaultSiteInstanceTest : public SitePerProcessWebViewTest {};

// Check that when strict site isolation is turned off (via a command-line flag
// or from chrome://flags), the <webview> site isolation paths still work. In
// particular, <webview> navigations should use a default SiteInstance which
// should still be considered a guest SiteInstance in the guest's
// StoragePartition.  Cross-site navigations in the guest should stay in the
// same SiteInstance, and the guest process shouldn't be locked.
IN_PROC_BROWSER_TEST_F(WebViewWithDefaultSiteInstanceTest, SimpleNavigations) {}

// Similar to the test above, but also exercises navigations to an isolated
// origin, which takes precedence over switches::kDisableSiteIsolation. In this
// setup, navigations to the isolated origin should use a normal SiteInstance
// that requires a dedicated process, while all other navigations should use
// the default SiteInstance and an unlocked process.
IN_PROC_BROWSER_TEST_F(WebViewWithDefaultSiteInstanceTest, IsolatedOrigin) {}

IN_PROC_BROWSER_TEST_F(WebViewWithDefaultSiteInstanceTest, FencedFrame) {}

class WebViewFencedFrameTest : public WebViewTest,
                               public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

IN_PROC_BROWSER_TEST_P(WebViewFencedFrameTest,
                       FencedFrameInGuestHasGuestSiteInstance) {}

class WebViewUsbTest : public WebViewTest {};

IN_PROC_BROWSER_TEST_F(WebViewUsbTest, Shim_TestCannotRequestUsb) {}

IN_PROC_BROWSER_TEST_F(WebViewUsbTest, Shim_TestCannotReuseUsbPairedInTab) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCannotRequestFonts) {}

IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCannotRequestFontsGrantedInTab) {}