#include "services/device/hid/hid_connection_impl.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h"
#include "base/test/test_future.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/device/device_service_test_base.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace device {
namespace {
ElementsAre;
ReadFuture;
WriteFuture;
GetFeatureFuture;
#if BUILDFLAG(IS_MAC)
const uint64_t kTestDeviceId = 123;
#elif BUILDFLAG(IS_WIN)
const wchar_t* kTestDeviceId = L"123";
#else
const char* kTestDeviceId = …;
#endif
const uint8_t kTestReportId = …;
const uint64_t kMaxReportSizeBytes = …;
class MockHidConnection : public HidConnection { … };
class TestHidConnectionClient : public mojom::HidConnectionClient { … };
}
class HidConnectionImplTest : public DeviceServiceTestBase { … };
TEST_F(HidConnectionImplTest, ReadWrite) { … }
TEST_F(HidConnectionImplTest, ReadWriteWithConnectionClient) { … }
TEST_F(HidConnectionImplTest, DestroyWithPendingInputReport) { … }
TEST_F(HidConnectionImplTest, DestroyWithPendingRead) { … }
TEST_F(HidConnectionImplTest, WatcherClosedWhenHidConnectionClosed) { … }
TEST_F(HidConnectionImplTest, HidConnectionClosedWhenWatcherClosed) { … }
TEST_F(HidConnectionImplTest, ReadZeroLengthInputReport) { … }
TEST_F(HidConnectionImplTest, ReadZeroLengthInputReportWithClient) { … }
TEST_F(HidConnectionImplTest, WriteZeroLengthOutputReport) { … }
TEST_F(HidConnectionImplTest, ReadZeroLengthFeatureReport) { … }
TEST_F(HidConnectionImplTest, WriteZeroLengthFeatureReport) { … }
}