chromium/chrome/browser/extensions/user_script_listener_unittest.cc

// Copyright 2012 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/extensions/user_script_listener.h"

#include <memory>
#include <optional>

#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/raw_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/threading/thread.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/scripting_utils.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/url_pattern_set.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#endif

NavigationThrottle;

namespace extensions {

namespace {

const char kMatchingUrl[] =;
const char kMatchingPrefsUrl[] =;
const char kNotMatchingUrl[] =;
const ExtensionId kTestExtensionId =;

// Yoinked from manifest_unittest.cc.
std::optional<base::Value::Dict> LoadManifestFile(const base::FilePath path,
                                                  std::string* error) {}

scoped_refptr<Extension> LoadExtension(const std::string& filename,
                                       std::string* error) {}

}  // namespace

class UserScriptListenerTest : public testing::Test {};

namespace {

TEST_F(UserScriptListenerTest, DelayAndUpdate) {}

// Test that requests matching URL patterns from persistent dynamic content
// scripts registered from previous sessions (stored inside prefs) are
// throttled.
TEST_F(UserScriptListenerTest, DelayForPersistentScriptPatterns) {}

TEST_F(UserScriptListenerTest, DelayAndUnload) {}

TEST_F(UserScriptListenerTest, NoDelayNoExtension) {}

TEST_F(UserScriptListenerTest, NoDelayNotMatching) {}

TEST_F(UserScriptListenerTest, MultiProfile) {}

// Test when the user scripts ready trigger occurs before the throttle's
// WillStartRequest function is called.  This can occur when there are multiple
// throttles.
TEST_F(UserScriptListenerTest, ResumeBeforeStart) {}

}  // namespace

}  // namespace extensions