#include "components/supervised_user/core/browser/supervised_user_url_filter.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/types/strong_alias.h"
#include "base/values.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/supervised_user/embedded_test_server_setup_mixin.h"
#include "chrome/test/supervised_user/supervision_mixin.h"
#include "components/history/core/browser/history_service.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/supervised_user/core/browser/supervised_user_interstitial.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "components/supervised_user/core/browser/supervised_user_settings_service.h"
#include "components/supervised_user/core/browser/supervised_user_utils.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/public/cpp/network_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
constexpr char kBlockedContentUkmName[] = …;
constexpr char kBlockedContentUkmMainFrameMetricName[] = …;
constexpr char kBlockedContentUkmIFrameMetricName[] = …;
NavigationController;
NavigationEntry;
WebContents;
namespace {
class SupervisedUserURLFilterTestBase : public MixinBasedInProcessBrowserTest { … };
class TabClosingObserver : public TabStripModelObserver { … };
SupervisedUserURLFilterTest;
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest, BlockNewTabAfterLoading) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest, DontShowInterstitialTwice) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest, GoBackOnDontProceed) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest,
ClosingBlockedTabDoesNotCrash) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest, BlockThenUnblock) { … }
class SupervisedUserBlockModeTest : public SupervisedUserURLFilterTestBase { … };
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterTest, RecordBlockedContentUkm) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
NavigateFromBlockedPageToBlockedPage) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, HistoryVisitRecorded) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
SendAccessRequestOnBlockedURL) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, OpenBlockedURLInNewTab) { … }
IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, Unblock) { … }
class MockSupervisedUserURLFilterObserver
: public supervised_user::SupervisedUserURLFilter::Observer { … };
class SupervisedUserURLFilterPrerenderingTest
: public SupervisedUserURLFilterTest { … };
IN_PROC_BROWSER_TEST_F(SupervisedUserURLFilterPrerenderingTest, OnURLChecked) { … }
}