#include "components/permissions/permission_decision_auto_blocker.h"
#include <map>
#include <memory>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/gtest_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/permissions/features.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/test/test_permissions_client.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
namespace permissions {
namespace {
PermissionStatus;
bool FilterGoogle(const GURL& url) { … }
bool FilterAll(const GURL& url) { … }
}
class PermissionDecisionAutoBlockerUnitTest : public testing::Test { … };
class MockObserver : public PermissionDecisionAutoBlocker::Observer { … };
TEST_F(PermissionDecisionAutoBlockerUnitTest, RemoveEmbargoAndResetCounts) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest,
DismissAfterRemovingEmbargoByURL) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest,
NonembargoedOriginRemoveEmbargoCounts) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, RemoveEmbargoCounts) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, RemoveEmbargoAndResetCounts_All) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, CheckEmbargoedOrigins) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, CheckEmbargoStatus) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, CheckEmbargoStartTime) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, TestDismissEmbargoBackoff) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, TestIgnoreEmbargoBackoff) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, TestIgnoreEmbargoUsingQuietUi) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest, TestDismissEmbargoUsingQuietUi) { … }
namespace {
void CheckFederatedIdentityApiEmbargoLiftedAfterTimeElapsing(
PermissionDecisionAutoBlocker* autoblocker,
base::SimpleTestClock* clock,
const GURL& url,
base::TimeDelta time_delta) { … }
void CheckFederatedIdentityAutoReauthnEmbargoLiftedAfterTimeElapsing(
PermissionDecisionAutoBlocker* autoblocker,
base::SimpleTestClock* clock,
const GURL& url,
base::TimeDelta time_delta) { … }
}
TEST_F(PermissionDecisionAutoBlockerUnitTest,
TestDismissFederatedIdentityApiBackoff) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest,
TestLogoutFederatedIdentityAutoReauthnBackoff) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest,
ObserverIsNotifiedWhenEmbargoStarts) { … }
TEST_F(PermissionDecisionAutoBlockerUnitTest,
RemovedObserverIsNotNotifiedWhenEmbargoStarts) { … }
}