#include "components/enterprise/browser/reporting/profile_report_generator.h"
#include <string>
#include "base/json/json_reader.h"
#include "base/json/values_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile_attributes_init_params.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/account_id/account_id.h"
#include "components/enterprise/browser/reporting/report_type.h"
#include "components/policy/core/common/mock_policy_service.h"
#include "components/policy/core/common/policy_map.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/sync/base/features.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_android.h"
#else
#include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h"
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/pref_names.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_builder.h"
#endif
NiceMock;
em;
namespace enterprise_reporting {
namespace {
constexpr char kProfile[] = …;
constexpr char16_t kProfile16[] = …;
constexpr char kIdleProfile[] = …;
constexpr char16_t kIdleProfile16[] = …;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char kAffiliationId1[] = …;
constexpr char kAffiliationId2[] = …;
#endif
#if !BUILDFLAG(IS_ANDROID)
const int kMaxNumberOfExtensionRequest = …;
constexpr char kExtensionId[] = …;
constexpr char kExtensionId2[] = …;
constexpr int kFakeTime = …;
constexpr char kJustification[] = …;
constexpr char kAllowedExtensionSettings[] = …;
constexpr char kBlockedExtensionSettings[] = …;
#endif
}
#if BUILDFLAG(IS_ANDROID)
typedef ReportingDelegateFactoryAndroid PlatformReportingDelegateFactory;
#else
PlatformReportingDelegateFactory;
#endif
class ProfileReportGeneratorTest : public ::testing::Test { … };
TEST_F(ProfileReportGeneratorTest, ProfileNotActivated) { … }
TEST_F(ProfileReportGeneratorTest, UnsignedInProfile) { … }
TEST_F(ProfileReportGeneratorTest, SignedInProfile) { … }
TEST_F(ProfileReportGeneratorTest,
SignedInProfileReplaceSyncPromosWithSigninPromos) { … }
TEST_F(ProfileReportGeneratorTest, ProfileIdObfuscate) { … }
TEST_F(ProfileReportGeneratorTest, PoliciesDisabled) { … }
TEST_F(ProfileReportGeneratorTest, PoliciesHidden) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(ProfileReportGeneratorTest, IsAffiliated) { … }
TEST_F(ProfileReportGeneratorTest, NotAffiliated) { … }
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
TEST_F(ProfileReportGeneratorTest, PendingRequest) { … }
TEST_F(ProfileReportGeneratorTest, PendingRequestNotSupportProfileReporting) { … }
TEST_F(ProfileReportGeneratorTest, NoPendingRequestWhenItsDisabled) { … }
TEST_F(ProfileReportGeneratorTest, FilterOutApprovedPendingRequest) { … }
TEST_F(ProfileReportGeneratorTest, FilterOutBlockedPendingRequest) { … }
TEST_F(ProfileReportGeneratorTest, TooManyRequests) { … }
TEST_F(ProfileReportGeneratorTest, DisableExtensionInfo) { … }
#endif
}