#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/chrome_client_side_detection_host_delegate.h"
#include "chrome/browser/safe_browsing/chrome_safe_browsing_blocking_page_factory.h"
#include "chrome/browser/safe_browsing/chrome_ui_manager_delegate.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_test.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/content/browser/client_side_detection_feature_cache.h"
#include "components/safe_browsing/content/browser/client_side_detection_service.h"
#include "components/safe_browsing/content/browser/client_side_phishing_model.h"
#include "components/safe_browsing/content/browser/ui_manager.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/client_model.pb.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/prerender_test_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.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"
namespace safe_browsing {
namespace {
_;
StrictMock;
class FakeDelegate : public ClientSideDetectionService::Delegate { … };
class FakeClientSideDetectionService : public ClientSideDetectionService { … };
class MockSafeBrowsingUIManager : public SafeBrowsingUIManager { … };
}
class ClientSideDetectionHostPrerenderBrowserTest
: public InProcessBrowserTest { … };
class ClientSideDetectionHostPrerenderExclusiveAccessBrowserTest
: public ExclusiveAccessTest { … };
IN_PROC_BROWSER_TEST_F(ClientSideDetectionHostPrerenderBrowserTest,
PrerenderShouldNotAffectClientSideDetection) { … }
IN_PROC_BROWSER_TEST_F(ClientSideDetectionHostPrerenderBrowserTest,
ClassifyPrerenderedPageAfterActivation) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderBrowserTest,
ClassifyPrerenderedPageAfterActivationAndCheckDebuggingMetadataCache) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderBrowserTest,
CheckDebuggingMetadataCacheAfterClearingCacheAfterNavigation) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderExclusiveAccessBrowserTest,
KeyboardLockTriggersPreclassificationCheck) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderExclusiveAccessBrowserTest,
PointerLockTriggersPreClassificationCheck) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderExclusiveAccessBrowserTest,
KeyboardLockClassificationTriggersCSPPPing) { … }
IN_PROC_BROWSER_TEST_F(
ClientSideDetectionHostPrerenderExclusiveAccessBrowserTest,
PointerLockClassificationTriggersCSPPPing) { … }
class ClientSideDetectionHostVibrateTest : public InProcessBrowserTest { … };
class VibrationObserverWaiter : public content::WebContentsObserver { … };
IN_PROC_BROWSER_TEST_F(ClientSideDetectionHostVibrateTest,
VibrationApiTriggersPreclassificationCheck) { … }
IN_PROC_BROWSER_TEST_F(ClientSideDetectionHostVibrateTest,
VibrationApiClassificationTriggersCSPPPing) { … }
}