#include <memory>
#include <utility>
#include "base/memory/ref_counted.h"
#include "components/version_info/channel.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/features/feature_session_type.h"
#include "extensions/common/mojom/feature_session_type.mojom.h"
#include "extensions/common/permissions/usb_device_permission.h"
#include "extensions/common/permissions/usb_device_permission_data.h"
#include "services/device/public/cpp/test/fake_usb_device_info.h"
#include "services/device/public/mojom/usb_device.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace {
const int kUsbConfigWithInterfaces = …;
const int kUsbConfigWithoutInterfaces = …;
scoped_refptr<device::FakeUsbDeviceInfo> CreateTestUsbDevice(
uint16_t vendor_id,
uint16_t product_id,
uint8_t device_class,
const std::vector<uint8_t> interface_classes) { … }
scoped_refptr<const Extension> CreateTestApp(
base::Value usb_device_permission) { … }
}
TEST(USBDevicePermissionTest, PermissionDataOrder) { … }
TEST(USBDevicePermissionTest, CheckVendorAndProductId) { … }
TEST(USBDevicePermissionTest, CheckInterfaceId) { … }
TEST(USBDevicePermissionTest, InterfaceClass) { … }
TEST(USBDevicePermissionTest, InterfaceClassWithVendorId) { … }
TEST(USBDevicePermissionTest, CheckHidUsbAgainstInterfaceClass) { … }
TEST(USBDevicePermissionTest, CheckHidUsbAgainstDeviceIds) { … }
TEST(USBDevicePermissionTest, CheckDeviceAgainstDeviceIds) { … }
TEST(USBDevicePermissionTest, CheckDeviceAgainstDeviceClass) { … }
TEST(USBDevicePermissionTest, IgnoreNullDeviceClass) { … }
TEST(USBDevicePermissionTest, CheckDeviceAgainstInterfaceClass) { … }
TEST(USBDevicePermissionTest, CheckDeviceAndInterfaceId) { … }
TEST(USBDevicePermissionTest,
CheckDeviceAndInterfaceIDAgainstMissingInterfaceId) { … }
TEST(USBDevicePermissionTest, InvalidPermission_NoVendorId) { … }
TEST(USBDevicePermissionTest, InvalidPermission_OnlyVendorId) { … }
TEST(USBDevicePermissionTest, InvalidPermission_NoProductIdWithInterfaceId) { … }
TEST(USBDevicePermissionTest, RejectInterfaceIdIfInterfaceClassPresent) { … }
}