#include <stdint.h>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/metrics/field_trial_params.h"
#include "build/build_config.h"
#include "chrome/browser/background_sync/background_sync_delegate_impl.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "components/background_sync/background_sync_controller_impl.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/test/test_history_database.h"
#include "components/site_engagement/content/site_engagement_score.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/background_sync_parameters.h"
#include "content/public/browser/background_sync_registration.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/android/background_sync_launcher_android.h"
#endif
namespace {
BackgroundSyncController;
const char kFieldTrialGroup[] = …;
const char kExampleUrl[] = …;
const char kTag[] = …;
constexpr base::TimeDelta kSmallerThanMinGap = …;
constexpr base::TimeDelta kLargerThanMinGap = …;
constexpr base::TimeDelta kLargerThanMinGapExpectedDelay = …;
std::unique_ptr<KeyedService> BuildTestHistoryService(
const base::FilePath& file_path,
content::BrowserContext* context) { … }
class BackgroundSyncControllerImplTest : public testing::Test { … };
TEST_F(BackgroundSyncControllerImplTest, NoFieldTrial) { … }
TEST_F(BackgroundSyncControllerImplTest, SomeParamsSet) { … }
TEST_F(BackgroundSyncControllerImplTest, AllParamsSet) { … }
TEST_F(BackgroundSyncControllerImplTest, OneShotSyncMultipleAttempts) { … }
TEST_F(BackgroundSyncControllerImplTest, PeriodicSyncMultipleAttempts) { … }
TEST_F(BackgroundSyncControllerImplTest,
GetNextEventDelayWithSiteEngagementPenalty) { … }
TEST_F(BackgroundSyncControllerImplTest, MaxFrequencyForOrigin) { … }
TEST_F(BackgroundSyncControllerImplTest, CrossRegistrationLimitsForOrigin) { … }
}