#include "components/enterprise/data_controls/core/browser/data_controls_policy_handler.h"
#include <memory>
#include <optional>
#include "base/json/json_reader.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/prefs/pref_value_map.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace data_controls {
namespace {
constexpr char kTestPref[] = …;
constexpr char kPolicyName[] = …;
constexpr char kSchema[] = …;
constexpr char kValidPolicy[] = …;
constexpr char kPartiallyValidPolicy[] = …;
constexpr policy::PolicySource kCloudSources[] = …;
constexpr policy::PolicySource kNonCloudSources[] = …;
constexpr char kInvalidPolicy[] = …;
constexpr std::pair<const char*, const char16_t*> kInvalidTestCases[] = …;
class DataControlsPolicyHandlerTest : public testing::Test { … };
class DataControlsPolicyHandlerInvalidKeysTest
: public testing::WithParamInterface<
std::pair<const char*, const char16_t*>>,
public DataControlsPolicyHandlerTest { … };
INSTANTIATE_TEST_SUITE_P(…);
}
TEST_F(DataControlsPolicyHandlerTest, AllowsCloudSources) { … }
TEST_F(DataControlsPolicyHandlerTest, BlocksNonCloudSources) { … }
TEST_F(DataControlsPolicyHandlerTest, WarnInvalidSchema) { … }
TEST_F(DataControlsPolicyHandlerTest, AllowsPartiallyValidRules) { … }
TEST_P(DataControlsPolicyHandlerInvalidKeysTest, Test) { … }
}