chromium/chrome/browser/subresource_filter/subresource_filter_fenced_frame_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 "chrome/browser/subresource_filter/subresource_filter_browser_test_harness.h"

#include "base/strings/pattern.h"
#include "base/test/bind.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h"
#include "components/subresource_filter/core/browser/subresource_filter_constants.h"
#include "components/subresource_filter/core/common/test_ruleset_utils.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

RenderFrameHost;
_;
Mock;

namespace subresource_filter {

namespace {
// This string comes from GetErrorStringForDisallowedLoad() in
// blink/renderer/core/loader/subresource_filter.cc
constexpr const char kBlinkDisallowChildFrameConsoleMessageFormat[] =;
}  // namespace

// Tests that AddMessageToConsole() is not called from NavigationConsoleLogger
// with a fenced frame to ensure that it works only with the outermost main
// frame.
IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest,
                       NavigatesToURLWithWarning_NoMessageLogged) {}

IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest,
                       CollapseBlockedFencedFrame) {}

// Test that filtering resources inside a fencedframe works when the outer page
// is activated.
IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest,
                       OutermostFrameActivation) {}

// Tests that navigations of a fenced frame are correctly blocked when the
// outer page is activated and the fenced frame URL matches a blocklist or
// allowlist rule.
IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest,
                       FencedFrameLoadFiltering) {}

// Same as above test but tests filtering of navigations occurring inside
// subframes embedded within in a fenced frame.
IN_PROC_BROWSER_TEST_F(SubresourceFilterFencedFrameBrowserTest,
                       LoadFilteringNestedInFencedFrame) {}

}  // namespace subresource_filter