#include "chrome/browser/web_applications/web_app_pref_guardrails.h"
#include <memory>
#include <string_view>
#include "base/json/values_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/rand_util.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "components/webapps/browser/features.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace web_app {
namespace {
const webapps::AppId app_id = …;
}
class WebAppGuardrailsTest : public testing::Test { … };
class WebAppGuardrailsIphTest : public WebAppGuardrailsTest { … };
TEST_F(WebAppGuardrailsIphTest, Ignore) { … }
TEST_F(WebAppGuardrailsIphTest, IgnoreRecordUpdated) { … }
TEST_F(WebAppGuardrailsIphTest, InstallResetCounters) { … }
TEST_F(WebAppGuardrailsIphTest, AppIgnoredRecently) { … }
TEST_F(WebAppGuardrailsIphTest, GlobalIgnoredRecently) { … }
TEST_F(WebAppGuardrailsIphTest, GlobalIgnoredPassedMuteTime) { … }
TEST_F(WebAppGuardrailsIphTest, TestIphAppIgnoredPassedMuteTime) { … }
TEST_F(WebAppGuardrailsIphTest, TestIphConsecutiveAppIgnore) { … }
TEST_F(WebAppGuardrailsIphTest, TestGlobalConsecutiveAppIgnore) { … }
class WebAppGuardrailsMLTest : public WebAppGuardrailsTest { … };
TEST_F(WebAppGuardrailsMLTest, MLInstallIgnored) { … }
TEST_F(WebAppGuardrailsMLTest, MLInstallDismissed) { … }
TEST_F(WebAppGuardrailsMLTest, MLAcceptResetsCounters) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailConsecutiveAppSpecificIgnores) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailAppSpecificIgnoreForDays) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailAppSpecificDismissForDays) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailConsecutiveAppAgnosticIgnores) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailConsecutiveAppAgnosticIgnoreDays) { … }
TEST_F(WebAppGuardrailsMLTest, MLGuardrailConsecutiveAppAgnosticDismissDays) { … }
class WebAppPrefsMLGuardrailsMaxStorageTest : public WebAppTest { … };
TEST_F(WebAppPrefsMLGuardrailsMaxStorageTest,
BasicBehaviorGuardrailBlockedAfter5NonAccepts) { … }
TEST_F(WebAppPrefsMLGuardrailsMaxStorageTest,
MLBlockedPrefClearedOnInstallAccept) { … }
TEST_F(WebAppPrefsMLGuardrailsMaxStorageTest,
MoreThan5NonAcceptsDoesNotUpdateBlockTime) { … }
TEST_F(WebAppPrefsMLGuardrailsMaxStorageTest, ClearAndResetGuardrails) { … }
#if !BUILDFLAG(IS_CHROMEOS)
class WebAppPrefsLinkCapturingIPHGuardrailsTest : public WebAppTest { … };
TEST_F(WebAppPrefsLinkCapturingIPHGuardrailsTest, Dismiss) { … }
TEST_F(WebAppPrefsLinkCapturingIPHGuardrailsTest, Accept) { … }
TEST_F(WebAppPrefsLinkCapturingIPHGuardrailsTest,
GuardrailsBlockedAfter6Dismisses) { … }
TEST_F(WebAppPrefsLinkCapturingIPHGuardrailsTest, ClearAndResetGuardrails) { … }
#endif
}