chromium/content/browser/renderer_host/ancestor_throttle_browsertest.cc

// Copyright 2019 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/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/web_contents/web_contents_impl.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_utils.h"
#include "content/public/test/content_mock_cert_verifier.h"
#include "content/public/test/signed_exchange_browser_test_helper.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/base/filename_util.h"
#include "net/dns/mock_host_resolver.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/embedded_test_server/request_handler_util.h"
#include "services/network/public/cpp/features.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace content {

namespace {

base::FilePath TestFilePath(const char* filename) {}

class AncestorThrottleTest : public ContentBrowserTest,
                             public ::testing::WithParamInterface<bool> {};

// Tests that an iframe navigation with frame-ancestors 'none' is blocked.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, FailedCSP) {}

// Tests that X-Frame-Options is ignored if frame-ancestors is specified.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, XFOAndCSPFrameAncestors) {}

// Tests that redirecting on a forbidden frame-ancestors will still commit if
// the final response does not have a CSP policy that prevents the navigation.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, RedirectCommitsIfNoCSP) {}

// Tests that redirecting on a forbidden frame-ancestors will not commit if
// the final response does have a CSP policy that prevents the navigation.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, RedirectFails) {}

// Check that we don't process CSP for 204 responses.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, Response204CSP) {}

// Tests iframes embedded by local files.
IN_PROC_BROWSER_TEST_F(AncestorThrottleTest, FrameAncestorsFileURLs) {}

class AncestorThrottleSXGTest : public AncestorThrottleTest {};

IN_PROC_BROWSER_TEST_F(AncestorThrottleSXGTest, SXGWithCSP) {}

}  // namespace

}  // namespace content