#include "chrome/browser/hid/hid_policy_allowed_devices.h"
#include <string>
#include <string_view>
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "services/device/public/cpp/test/fake_hid_manager.h"
#include "services/device/public/mojom/hid.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace {
ParseJson;
UnorderedElementsAre;
class HidPolicyAllowedDevicesTest : public testing::Test { … };
}
TEST_F(HidPolicyAllowedDevicesTest, InitializeWithMissingPrefValue) { … }
TEST_F(HidPolicyAllowedDevicesTest, InitializeWithExistingEmptyPrefValue) { … }
namespace {
constexpr uint16_t kTestVendorId1 = …;
constexpr uint16_t kTestVendorId2 = …;
constexpr uint16_t kTestProductId1 = …;
constexpr uint16_t kTestProductId2 = …;
constexpr uint16_t kTestUsagePage1 = …;
constexpr uint16_t kTestUsagePage2 = …;
constexpr uint16_t kTestUsage1 = …;
constexpr uint16_t kTestUsage2 = …;
constexpr char kAllowDevicesForUrls[] = …;
constexpr char kAllowDevicesWithHidUsagesForUrls[] = …;
constexpr char kAllowAllDevicesForUrls[] = …;
}
TEST_F(HidPolicyAllowedDevicesTest, InitializeWithPrefValues) { … }
TEST_F(HidPolicyAllowedDevicesTest, InitializeWithMissingPrefValuesThenUpdate) { … }
TEST_F(HidPolicyAllowedDevicesTest,
InitializeWithMissingPrefValuesThenUpdateOnLoginScreen) { … }
TEST_F(HidPolicyAllowedDevicesTest, InitializeWithPrefValuesThenRemovePolicy) { … }
TEST_F(HidPolicyAllowedDevicesTest, MultipleUrls) { … }
TEST_F(HidPolicyAllowedDevicesTest, MultipleItemsWithOverlap) { … }