#include "components/variations/service/safe_seed_manager.h"
#include <memory>
#include <string>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "components/metrics/clean_exit_beacon.h"
#include "components/prefs/testing_pref_service.h"
#include "components/variations/client_filterable_state.h"
#include "components/variations/pref_names.h"
#include "components/variations/service/safe_seed_manager_base.h"
#include "components/variations/variations_safe_seed_store_local_state.h"
#include "components/variations/variations_seed_store.h"
#include "components/variations/variations_switches.h"
#include "components/variations/variations_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace variations {
namespace {
const char kTestSeed[] = …;
const char kTestSignature[] = …;
const int kTestSeedMilestone = …;
const char kTestLocale[] = …;
const char kTestPermanentConsistencyCountry[] = …;
const char kTestSessionConsistencyCountry[] = …;
base::Time GetTestFetchTime() { … }
class FakeSeedStore : public VariationsSeedStore { … };
void SetDefaultActiveState(SafeSeedManager* safe_seed_manager,
PrefService* local_state) { … }
void ExpectDefaultActiveState(const FakeSeedStore& seed_store) { … }
}
class SafeSeedManagerTest : public ::testing::Test { … };
TEST_F(SafeSeedManagerTest, RecordSuccessfulFetch_FirstCallSavesSafeSeed) { … }
TEST_F(SafeSeedManagerTest, RecordSuccessfulFetch_RepeatedCallsRetainSafeSeed) { … }
TEST_F(SafeSeedManagerTest,
RecordSuccessfulFetch_NoActiveState_DoesntSaveSafeSeed) { … }
TEST_F(SafeSeedManagerTest, FetchFailureMetrics_DefaultPrefs) { … }
TEST_F(SafeSeedManagerTest, FetchFailureMetrics_NoFailures) { … }
TEST_F(SafeSeedManagerTest, FetchFailureMetrics_SomeFailures) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_OverriddenByCommandlineFlag) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_NoCrashes_NoFetchFailures) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_NoPrefs) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_FewCrashes_FewFetchFailures) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_ManyCrashes_NoFetchFailures) { … }
TEST_F(SafeSeedManagerTest,
ShouldRunInSafeMode_ManyMoreCrashes_NoFetchFailures) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_NoCrashes_ManyFetchFailures) { … }
TEST_F(SafeSeedManagerTest,
ShouldRunInSafeMode_NoCrashes_ManyMoreFetchFailures) { … }
TEST_F(SafeSeedManagerTest, ShouldRunInSafeMode_ManyCrashes_ManyFetchFailures) { … }
TEST_F(SafeSeedManagerTest,
ShouldRunInSafeMode_ManyMoreCrashes_ManyMoreFetchFailures) { … }
}