chromium/extensions/browser/api/hid/hid_apitest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include <stddef.h>
#include <stdint.h>

#include <memory>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "extensions/browser/api/device_permissions_prompt.h"
#include "extensions/browser/api/hid/hid_device_manager.h"
#include "extensions/shell/browser/shell_extensions_api_client.h"
#include "extensions/shell/test/shell_apitest.h"
#include "extensions/test/extension_test_message_listener.h"
#include "services/device/public/cpp/hid/hid_report_descriptor.h"
#include "services/device/public/cpp/test/fake_hid_manager.h"
#include "services/device/public/mojom/hid.mojom.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/dbus/permission_broker/fake_permission_broker_client.h"  // nogncheck
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace extensions {

namespace {

FakeHidManager;
HidReportDescriptor;

const char* const kTestDeviceGuids[] =;
const char* const kTestPhysicalDeviceIds[] =;

// These report descriptors define two devices with 8-byte input, output and
// feature reports. The first implements usage page 0xFF00 and has a single
// report without and ID. The second implements usage page 0xFF01 and has a
// single report with ID 1.
const uint8_t kReportDescriptor[] =;
const uint8_t kReportDescriptorWithIDs[] =;

// Device IDs for the device granted permission by the manifest.
constexpr uint16_t kTestVendorId =;
constexpr uint16_t kTestProductId =;

}  // namespace

class TestDevicePermissionsPrompt
    : public DevicePermissionsPrompt,
      public DevicePermissionsPrompt::Prompt::Observer {};

class TestExtensionsAPIClient : public ShellExtensionsAPIClient {};

class HidApiTest : public ShellApiTest {};

IN_PROC_BROWSER_TEST_F(HidApiTest, HidApp) {}

IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceAdded) {}

IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceRemoved) {}

namespace {

device::mojom::HidDeviceInfoPtr CreateDeviceWithOneCollection(
    const std::string& guid) {}

device::mojom::HidDeviceInfoPtr CreateDeviceWithTwoCollections(
    const std::string guid) {}

}  // namespace

IN_PROC_BROWSER_TEST_F(HidApiTest, DeviceAddedChangedRemoved) {}

}  // namespace extensions