chromium/extensions/browser/content_script_matching_browsertest.cc

// Copyright 2018 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/memory/raw_ptr.h"
#include "extensions/browser/script_injection_tracker.h"

#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/common/extension.h"
#include "extensions/shell/browser/shell_extension_loader.h"
#include "extensions/shell/test/shell_apitest.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace extensions {

// Test suite covering
// `extensions::ScriptInjectionTracker::DoStaticContentScriptsMatchForTesting`
// from //extensions/browser/script_injection_tracker.h.
//
// See also ScriptInjectionTrackerBrowserTest in
// //chrome/browser/extensions/script_injection_tracker_browsertest.cc.
// TODO(crbug.com/40061759): Add test coverage for dynamic content and user
// scripts matching.
class ContentScriptMatchingBrowserTest : public ShellApiTest,
                                         public content::WebContentsDelegate {};

IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       ContentScriptMatching_ChainTraversalForBar) {}

IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       ContentScriptMatching_ChainTraversalForFoo) {}

IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       ContentScriptMatching_NoMatchingOfAboutBlank) {}

// Flaky on MacOS since r622662. See https://crbug.com/921883
#if BUILDFLAG(IS_MAC)
#define MAYBE_ContentScriptMatching_NotAllFrames
#else
#define MAYBE_ContentScriptMatching_NotAllFrames
#endif
IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       MAYBE_ContentScriptMatching_NotAllFrames) {}

IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       ContentScriptMatching_NotYetCommittedURL) {}

IN_PROC_BROWSER_TEST_F(ContentScriptMatchingBrowserTest,
                       ContentScriptMatching_CssIsIgnored) {}

}  // namespace extensions