#include "components/metrics/metrics_state_manager.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "components/metrics/client_info.h"
#include "components/metrics/metrics_data_validation.h"
#include "components/metrics/metrics_log.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/metrics/metrics_service.h"
#include "components/metrics/metrics_switches.h"
#include "components/metrics/test/test_enabled_state_provider.h"
#include "components/prefs/testing_pref_service.h"
#include "components/variations/pref_names.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
namespace metrics {
namespace {
void VerifyClientId(const std::string& client_id) { … }
MATCHER(HaveClonedInstallInfo, "") { … }
MATCHER(HaveNoClonedInstallInfo, "") { … }
}
class MetricsStateManagerTest : public testing::Test { … };
TEST_F(MetricsStateManagerTest, ClientIdCorrectlyFormatted_ConsentInitially) { … }
TEST_F(MetricsStateManagerTest, ClientIdCorrectlyFormatted_ConsentLater) { … }
TEST_F(MetricsStateManagerTest, EntropySourceUsed_Low) { … }
TEST_F(MetricsStateManagerTest, EntropySourceUsed_High) { … }
TEST_F(MetricsStateManagerTest, EntropySourceUsed_High_ExternalClientId) { … }
TEST_F(MetricsStateManagerTest,
EntropySourceUsed_High_ExternalClientId_MetricsReportingDisabled) { … }
TEST_F(MetricsStateManagerTest, ResetMetricsIDs) { … }
TEST_F(MetricsStateManagerTest, LogHasSessionShutdownCleanly) { … }
TEST_F(MetricsStateManagerTest, LogSessionHasNotYetShutdownCleanly) { … }
TEST_F(MetricsStateManagerTest, ForceClientIdCreation) { … }
TEST_F(MetricsStateManagerTest,
ForceClientIdCreation_ConsentIntitially_NoInstallDate) { … }
#if !BUILDFLAG(IS_WIN)
TEST_F(MetricsStateManagerTest, ProvisionalClientId_PromotedToClientId) { … }
TEST_F(MetricsStateManagerTest, ProvisionalClientId_PersistedAcrossFirstRuns) { … }
#endif
TEST_F(MetricsStateManagerTest, LoadPrefs) { … }
TEST_F(MetricsStateManagerTest, PreferPrefs) { … }
TEST_F(MetricsStateManagerTest, RestoreBackup) { … }
TEST_F(MetricsStateManagerTest, ResetBackup) { … }
TEST_F(MetricsStateManagerTest, CheckProvider) { … }
TEST_F(MetricsStateManagerTest, CheckProviderLogNormal) { … }
TEST_F(MetricsStateManagerTest, CheckProviderLogNormalWithParams) { … }
TEST_F(MetricsStateManagerTest, CheckClientIdWasNotUsedToAssignFieldTrial) { … }
TEST_F(MetricsStateManagerTest, CheckClientIdWasUsedToAssignFieldTrial) { … }
TEST_F(MetricsStateManagerTest, CheckProviderResetIds) { … }
TEST_F(MetricsStateManagerTest,
CheckProviderResetIds_PreviousIdOnlyReportInResetSession) { … }
TEST_F(MetricsStateManagerTest, UseExternalClientId) { … }
}