chromium/content/browser/security/coop/cross_origin_opener_policy_reporting_browsertest.cc

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

#include "base/logging.h"
#include "base/run_loop.h"
#include "base/synchronization/lock.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/thread_annotations.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/content_navigation_policy.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/content_cert_verifier_browser_test.h"
#include "content/public/test/content_mock_cert_verifier.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/base/features.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace content {
namespace {

Eq;

const char kReportingHost[] =;
const char kCrossOriginHost[] =;

// This browsertest focuses on testing that Reporting-Endpoints header can be
// parsed before navigation commits and there's no memory leak from the
// transient reporting endpoints created during navigation.
class CrossOriginOpenerPolicyReportingBrowserTest
    : public CertVerifierBrowserTest {};

}  // namespace

// This observer manually queues reports (type doesn't matter) for each
// transient reporting source created during this navigation after this
// navigation has finished. Such reports must be dropped because transient
// reporting sources should be marked as expired at this point.
class SendTestReportsAtNavigationFinishObserver : public WebContentsObserver {};

IN_PROC_BROWSER_TEST_F(CrossOriginOpenerPolicyReportingBrowserTest,
                       BasicReportingEndpointsReportSucceedOnOpener) {}

IN_PROC_BROWSER_TEST_F(CrossOriginOpenerPolicyReportingBrowserTest,
                       ParseReportingEndpointsDuringNavigation) {}

IN_PROC_BROWSER_TEST_F(CrossOriginOpenerPolicyReportingBrowserTest,
                       ParseReportingEndpointsDuringRedirects) {}

IN_PROC_BROWSER_TEST_F(CrossOriginOpenerPolicyReportingBrowserTest,
                       RedirectHeadersRemovedAfterNavigationComplete) {}

IN_PROC_BROWSER_TEST_F(CrossOriginOpenerPolicyReportingBrowserTest,
                       RedirectHeadersRemovedAfterNavigationFailed) {}

}  // namespace content