#include "chrome/browser/policy/webhid_device_policy_handler.h"
#include <memory>
#include <utility>
#include "base/strings/string_util.h"
#include "base/test/values_test_util.h"
#include "chrome/common/pref_names.h"
#include "components/policy/core/browser/configuration_policy_pref_store.h"
#include "components/policy/core/browser/configuration_policy_pref_store_test.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/policy/policy_constants.h"
namespace policy {
namespace {
IsJson;
ParseJson;
WithParamInterface;
constexpr char kDevicesKey[] = …;
constexpr char kUsagesKey[] = …;
constexpr char kUrlsKey[] = …;
constexpr char kVendorIdKey[] = …;
constexpr char kProductIdKey[] = …;
constexpr char kUsagePageKey[] = …;
constexpr char kUsageKey[] = …;
}
class WebHidDevicePolicyHandlerTest : public ConfigurationPolicyPrefStoreTest { … };
namespace {
constexpr uint16_t kTestVendorId1 = …;
constexpr uint16_t kTestVendorId2 = …;
constexpr uint16_t kTestVendorId3 = …;
constexpr uint16_t kTestProductId = …;
constexpr uint16_t kTestUsagePage1 = …;
constexpr uint16_t kTestUsagePage2 = …;
constexpr uint16_t kTestUsagePage3 = …;
constexpr uint16_t kTestUsage = …;
constexpr char kAllowDevicesForUrls[] = …;
constexpr char kAllowDevicesWithHidUsagesForUrls[] = …;
}
TEST_F(WebHidDevicePolicyHandlerTest, CheckPolicySettingsWithDevicePolicy) { … }
TEST_F(WebHidDevicePolicyHandlerTest, CheckPolicySettingsWithUsagePolicy) { … }
TEST_F(WebHidDevicePolicyHandlerTest, ApplyPolicySettingsWithDevicePolicy) { … }
TEST_F(WebHidDevicePolicyHandlerTest, ApplyPolicySettingsWithUsagePolicy) { … }
struct WebHidInvalidPolicyTestData { … };
class WebHidInvalidPolicyTest
: public WebHidDevicePolicyHandlerTest,
public WithParamInterface<WebHidInvalidPolicyTestData> { … };
TEST_P(WebHidInvalidPolicyTest, CheckPolicySettingsWithInvalidPolicy) { … }
WebHidInvalidPolicyTestData kTestData[]{ … };
INSTANTIATE_TEST_SUITE_P(…);
}