#include "components/enterprise/connectors/core/enterprise_connectors_policy_handler.h"
#include <memory>
#include <optional>
#include <tuple>
#include "base/json/json_reader.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/enterprise/connectors/core/connectors_prefs.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/schema.h"
#include "components/prefs/pref_value_map.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace enterprise_connectors {
namespace {
const char kTestPref[] = …;
const char kTestScopePref[] = …;
const char kPolicyName[] = …;
const char kSchema[] = …;
constexpr char kEmptyPolicy[] = …;
constexpr char kValidPolicy[] = …;
constexpr char kInvalidPolicy[] = …;
constexpr char kValidLocalContentAnalysisPolicy[] = …;
constexpr char kInvalidProviderLocalContentAnalysisPolicy[] = …;
constexpr char kFakeProviderLocalContentAnalysisPolicy[] = …;
}
class EnterpriseConnectorsPolicyHandlerTestBase { … };
class EnterpriseConnectorsPolicyHandlerCloudOnlyTest
: public EnterpriseConnectorsPolicyHandlerTestBase,
public testing::TestWithParam<
std::tuple<const char*, const char*, policy::PolicySource>> { … };
TEST_P(EnterpriseConnectorsPolicyHandlerCloudOnlyTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
class EnterpriseConnectorsPolicyHandlerLocalTest
: public EnterpriseConnectorsPolicyHandlerTestBase,
public testing::TestWithParam<std::tuple<const char*, const char*>> { … };
TEST_P(EnterpriseConnectorsPolicyHandlerLocalTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
class EnterpriseConnectorsPolicyHandlerMergeTest
: public EnterpriseConnectorsPolicyHandlerTestBase,
public testing::Test { … };
TEST_F(EnterpriseConnectorsPolicyHandlerMergeTest, AllowMergedCloudSources) { … }
TEST_F(EnterpriseConnectorsPolicyHandlerMergeTest, BlockMergedNonCloudSources) { … }
}