#include "chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler.h"
#include <memory>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/values_test_util.h"
#include "components/content_settings/core/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;
constexpr char kDevicesKey[] = …;
constexpr char kUrlsKey[] = …;
constexpr char kVendorIdKey[] = …;
constexpr char kProductIdKey[] = …;
constexpr char kValidPolicy[] = …;
constexpr char kInvalidPolicyInvalidTopLevelEntry[] = …;
constexpr char kInvalidPolicyMissingDevicesProperty[] = …;
constexpr char kInvalidPolicyMissingUrlsProperty[] = …;
constexpr char kInvalidPolicyMismatchedVendorIdType[] = …;
constexpr char kInvalidPolicyMismatchedProductIdType[] = …;
constexpr char kInvalidPolicyUnknownProperty[] = …;
constexpr char kInvalidPolicyUnknownPropertyAfterCleanup[] = …;
constexpr char kInvalidPolicyProductIdWithoutVendorId[] = …;
constexpr char kInvalidPolicyInvalidRequestingUrl[] = …;
constexpr char kInvalidPolicyInvalidEmbeddingUrl[] = …;
constexpr char kInvalidPolicyInvalidUrlsEntry[] = …;
constexpr char InvalidPolicyNoUrls[] = …;
}
class WebUsbAllowDevicesForUrlsPolicyHandlerTest
: public ConfigurationPolicyPrefStoreTest { … };
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest, CheckPolicySettings) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithInvalidTopLevelEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithMissingDevicesProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithMissingUrlsProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithIntegerUrls) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsUnknownProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithMismatchedVendorIdType) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithMismatchedProductIdType) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithProductIdWithoutVendorId) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithInvalidRequestingUrlEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithInvalidEmbeddingUrlEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithInvalidUrlsEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckPolicySettingsWithNoUrls) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest, ApplyPolicySettings) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithInvalidTopLevelEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithMissingDevicesProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithMissingUrlsProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithUnknownProperty) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithMismatchedVendorIdType) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsWithMismatchedProductIdType) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsProductIdWithoutVendorId) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsInvalidRequestingUrl) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsInvalidEmbeddingUrl) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
ApplyPolicySettingsInvalidUrlsEntry) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest, ApplyPolicySettingsNoUrls) { … }
TEST_F(WebUsbAllowDevicesForUrlsPolicyHandlerTest,
CheckAndApplyPolicySettingsWithUnknownTopLevelKey) { … }
}