#include "content/public/browser/web_contents_observer.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/service_worker/embedded_worker_instance.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/allow_service_worker_result.h"
#include "content/public/browser/focused_node_details.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/mock_web_contents_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/site_for_cookies.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/default_handlers.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/switches.h"
#include "ui/base/ui_base_switches.h"
_;
NotNull;
namespace content {
class WebContentsObserverBrowserTest : public ContentBrowserTest { … };
namespace {
class ServiceWorkerAccessObserver : public WebContentsObserver { … };
}
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
OnServiceWorkerAccessed) { … }
namespace {
class ServiceWorkerAccessContentBrowserClient
: public ContentBrowserTestContentBrowserClient { … };
}
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
OnServiceWorkerAccessed_ContentClientBlocked) { … }
namespace {
enum class ContextType { … };
class CookieTracker : public WebContentsObserver { … };
CookieAccess;
MATCHER_P9(MatchesCookieAccess,
type,
context_type,
frame_id,
navigation_id,
url,
first_party_url,
cookie_name,
cookie_value,
cookie_access_result,
"") { … }
}
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)
#define MAYBE_CookieCallbacks_MainFrame …
#else
#define MAYBE_CookieCallbacks_MainFrame …
#endif
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
MAYBE_CookieCallbacks_MainFrame) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
#define MAYBE_CookieCallbacks_MainFrameRedirect …
#else
#define MAYBE_CookieCallbacks_MainFrameRedirect …
#endif
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
MAYBE_CookieCallbacks_MainFrameRedirect) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_CookieCallbacks_Subframe …
#else
#define MAYBE_CookieCallbacks_Subframe …
#endif
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
MAYBE_CookieCallbacks_Subframe) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)
#define MAYBE_CookieCallbacks_Subresource …
#else
#define MAYBE_CookieCallbacks_Subresource …
#endif
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
MAYBE_CookieCallbacks_Subresource) { … }
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
CookieCallbacks_DocumentCookie) { … }
class WebContentsObserverBrowserTestWithTPCD
: public WebContentsObserverBrowserTest { … };
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTestWithTPCD,
CookieCallbacks_BlockedAccessStatusForwarded) { … }
namespace {
class FocusedNodeObserver : public WebContentsObserver { … };
IN_PROC_BROWSER_TEST_F(WebContentsObserverBrowserTest,
OnFocusChangedInPageFocusType) { … }
}
namespace {
class ColorSchemeObserver : public WebContentsObserver { … };
class WebContentsObserverColorSchemeBrowserTest
: public WebContentsObserverBrowserTest,
public testing::WithParamInterface<blink::mojom::PreferredColorScheme> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(WebContentsObserverColorSchemeBrowserTest,
ColorSchemeInferred) { … }
}
}