#include "components/safe_browsing/content/browser/async_check_tracker.h"
#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "components/safe_browsing/content/browser/base_ui_manager.h"
#include "components/safe_browsing/content/browser/url_checker_holder.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/security_interstitials/core/unsafe_resource.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/test_renderer_host.h"
namespace safe_browsing {
namespace {
UnsafeResource;
class MockUIManager : public BaseUIManager { … };
constexpr int kLocalNavigationTimestampsSizeThreshold = …;
}
class AsyncCheckTrackerTest : public content::RenderViewHostTestHarness { … };
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageNotCalled_PendingCheckNotFound) { … }
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageNotCalled_PendingCheckNotCompleted) { … }
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageNotCalled_PendingCheckProceed) { … }
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageNotCalled_PostCommitInterstitialNotSkipped) { … }
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageNotCalled_NavigationNotCommitted) { … }
TEST_F(AsyncCheckTrackerTest, DisplayBlockingPageCalled) { … }
TEST_F(AsyncCheckTrackerTest,
DisplayBlockingPageCalled_DidFinishNavigationCalledFirst) { … }
TEST_F(AsyncCheckTrackerTest, IsMainPageLoadPending) { … }
TEST_F(AsyncCheckTrackerTest, IsMainPageLoadPending_NoNavigationId) { … }
TEST_F(AsyncCheckTrackerTest,
IsMainPageLoadPending_DeleteExpiredNavigationTimestamps) { … }
TEST_F(
AsyncCheckTrackerTest,
IsMainPageLoadPending_DeleteExpiredNavigationTimestamps_NotReachingThreshold) { … }
TEST_F(AsyncCheckTrackerTest, GetBlockedPageCommittedTimestamp) { … }
TEST_F(AsyncCheckTrackerTest,
PendingCheckersManagement_TransferWithSameNavigationId) { … }
TEST_F(AsyncCheckTrackerTest,
PendingCheckersManagement_DeleteOldCheckersAfterDidFinishNavigation) { … }
TEST_F(AsyncCheckTrackerTest,
PendingCheckersManagement_CheckerNotDeletedIfAllChecksCompletedFalse) { … }
TEST_F(AsyncCheckTrackerTest,
PendingCheckersManagement_DestructWithPendingCheckers) { … }
class AsyncCheckTrackerTestObserver : public AsyncCheckTracker::Observer { … };
class AsyncCheckTrackerObserverTest : public AsyncCheckTrackerTest { … };
TEST_F(AsyncCheckTrackerObserverTest, OnAsyncSafeBrowsingCheckCompleted) { … }
TEST_F(AsyncCheckTrackerObserverTest, AsyncCheckTrackerDeletedWhileObserving) { … }
}