#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/device/serial/bluetooth_serial_port_impl.h"
#include <string>
#include <string_view>
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
#include "device/bluetooth/test/mock_bluetooth_device.h"
#include "device/bluetooth/test/mock_bluetooth_socket.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "net/base/io_buffer.h"
#include "services/device/public/cpp/bluetooth/bluetooth_utils.h"
#include "services/device/public/cpp/device_features.h"
#include "services/device/public/cpp/test/fake_serial_port_client.h"
#include "services/device/public/mojom/serial.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace device {
namespace {
RunOnceCallback;
_;
Invoke;
Return;
WithArgs;
constexpr char kBuffer[] = …;
const size_t kBufferNumBytes = …;
constexpr char kDiscardedBuffer[] = …;
constexpr char kDeviceAddress[] = …;
constexpr uint32_t kElementNumBytes = …;
constexpr uint32_t kCapacityNumBytes = …;
std::string CreateTestData(size_t buffer_size) { … }
MojoResult ReadConsumerData(mojo::ScopedDataPipeConsumerHandle& consumer,
std::string* read_data) { … }
class BluetoothSerialPortImplTest : public testing::Test { … };
}
TEST_F(BluetoothSerialPortImplTest, OpenFailure) { … }
TEST_F(BluetoothSerialPortImplTest, StartWritingTest) { … }
TEST_F(BluetoothSerialPortImplTest, StartReadingTest) { … }
TEST_F(BluetoothSerialPortImplTest, StartReadingLargeBufferTest) { … }
TEST_F(BluetoothSerialPortImplTest, FlushWrite) { … }
TEST_F(BluetoothSerialPortImplTest, FlushWriteWithDataInPipe) { … }
TEST_F(BluetoothSerialPortImplTest, FlushWriteAndWriteNewPipe) { … }
TEST_F(BluetoothSerialPortImplTest, FlushRead) { … }
TEST_F(BluetoothSerialPortImplTest, FlushReadAndReadNewPipe) { … }
TEST_F(BluetoothSerialPortImplTest, Drain) { … }
TEST_F(BluetoothSerialPortImplTest, Close) { … }
}