chromium/chrome/browser/ui/serial/serial_chooser_controller_unittest.cc

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

#include "chrome/browser/ui/serial/serial_chooser_controller.h"

#include <memory>
#include <utility>

#include "base/functional/callback_helpers.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "build/build_config.h"
#include "chrome/browser/serial/serial_blocklist.h"
#include "chrome/browser/serial/serial_chooser_context.h"
#include "chrome/browser/serial/serial_chooser_context_factory.h"
#include "chrome/browser/serial/serial_chooser_histograms.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/permissions/mock_chooser_controller_view.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/device/public/cpp/bluetooth/bluetooth_utils.h"
#include "services/device/public/cpp/test/fake_serial_port_manager.h"
#include "services/device/public/mojom/serial.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/serial/serial.mojom.h"

namespace {

BluetoothUUID;
MockBluetoothAdapter;
_;
Invoke;
Return;

constexpr char kBluetoothDevice1Address[] =;
constexpr char16_t kBluetoothDevice1Name[] =;
constexpr char kBluetoothDevice2Address[] =;
constexpr char16_t kBluetoothDevice2Name[] =;
const BluetoothUUID kRandomBluetoothServiceClassId(
    "34a0fe08-1c1f-4251-879e-2a8c397e56ee");

device::mojom::SerialPortInfoPtr CreateBluetoothPort(
    const std::string& device_address,
    const std::u16string& device_name,
    const BluetoothUUID& service_class_id) {}

}  // namespace

class SerialChooserControllerTest : public ChromeRenderViewHostTestHarness {};

TEST_F(SerialChooserControllerTest, GetPortsLateResponse) {}

TEST_F(SerialChooserControllerTest, PortsAddedAndRemoved) {}

TEST_F(SerialChooserControllerTest, PortSelected) {}

TEST_F(SerialChooserControllerTest, PortFiltered) {}

TEST_F(SerialChooserControllerTest, BluetoothPortFiltered) {}

TEST_F(SerialChooserControllerTest, BluetoothPortFilteredButNotAllowed) {}

TEST_F(SerialChooserControllerTest, DeviceNameDisambiguation) {}

class SerialChooserControllerTestWithBlockedPorts
    : public SerialChooserControllerTest {};

TEST_F(SerialChooserControllerTestWithBlockedPorts, Blocklist) {}

TEST_F(SerialChooserControllerTest,
       NotWirelessSerialPortExclusiveNoBluetoothServiceClassIds) {}

TEST_F(SerialChooserControllerTest,
       NotWirelessSerialPortExclusiveEmptyFilters) {}

TEST_F(SerialChooserControllerTest,
       NotWirelessSerialPortExclusiveFiltersWithBluetoothAndUsb) {}

TEST_F(SerialChooserControllerTest, SystemBluetoothPermissionDenied) {}

TEST_F(SerialChooserControllerTest, SystemBluetoothPermissionUndetermined) {}

TEST_F(SerialChooserControllerTest, AdapterPowerOffThenPowerOn) {}

TEST_F(SerialChooserControllerTest, AdapterPowerOffAfterOptionsInitialized) {}