Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90c62e10 authored by Chienyuan's avatar Chienyuan
Browse files

RootCanal: Make property of DUT/CERT device configurable

Tag: #refactor
Bug: 197316394
Test: gd/cert/run
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I398772b272e3e12e8def969dec0a9733c801be50
parent 6a3853ae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ void TestEnvironment::initialize(std::promise<void> barrier) {
  SetUpTestChannel();
  SetUpHciServer([this](std::shared_ptr<AsyncDataChannel> socket,
                        AsyncDataChannelServer* srv) {
    test_model_.IncomingHciConnection(socket);
    test_model_.IncomingHciConnection(socket, controller_properties_file_);
    srv->StartListening();
  });
  SetUpLinkLayerServer([this](std::shared_ptr<AsyncDataChannel> socket,
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ class TestEnvironment {
        hci_socket_server_(hci_server_port),
        link_socket_server_(link_server_port),
        connector_(connector),
        controller_properties_file_(controller_properties_file),
        default_commands_file_(default_commands_file),
        controller_(std::make_shared<test_vendor_lib::DualModeController>(
            controller_properties_file)) {}
@@ -69,6 +70,7 @@ class TestEnvironment {
  std::shared_ptr<AsyncDataChannelServer> hci_socket_server_;
  std::shared_ptr<AsyncDataChannelServer> link_socket_server_;
  std::shared_ptr<AsyncDataChannelConnector> connector_;
  std::string controller_properties_file_;
  std::string default_commands_file_;
  bool test_channel_open_{false};
  std::promise<void> barrier_;
+3 −2
Original line number Diff line number Diff line
@@ -26,8 +26,9 @@ using std::vector;

namespace test_vendor_lib {

HciSocketDevice::HciSocketDevice(std::shared_ptr<AsyncDataChannel> socket)
    : socket_(socket) {
HciSocketDevice::HciSocketDevice(std::shared_ptr<AsyncDataChannel> socket,
                                 std::string properties_filename)
    : DualModeController(properties_filename), socket_(socket) {
  advertising_interval_ms_ = std::chrono::milliseconds(1000);

  page_scan_delay_ms_ = std::chrono::milliseconds(600);
+5 −3
Original line number Diff line number Diff line
@@ -33,12 +33,14 @@ using android::net::AsyncDataChannel;

class HciSocketDevice : public DualModeController {
 public:
  HciSocketDevice(std::shared_ptr<AsyncDataChannel> socket);
  HciSocketDevice(std::shared_ptr<AsyncDataChannel> socket,
                  std::string properties_filename);
  ~HciSocketDevice() = default;

  static std::shared_ptr<HciSocketDevice> Create(
      std::shared_ptr<AsyncDataChannel> socket) {
    return std::make_shared<HciSocketDevice>(socket);
      std::shared_ptr<AsyncDataChannel> socket,
      std::string properties_filename) {
    return std::make_shared<HciSocketDevice>(socket, properties_filename);
  }

  virtual std::string GetTypeString() const override {
+3 −3
Original line number Diff line number Diff line
@@ -197,9 +197,9 @@ void TestModel::AddRemote(const std::string& server, int port,
  AddLinkLayerConnection(socket, phy_type);
}

void TestModel::IncomingHciConnection(
    std::shared_ptr<AsyncDataChannel> socket) {
  auto dev = HciSocketDevice::Create(socket);
void TestModel::IncomingHciConnection(std::shared_ptr<AsyncDataChannel> socket,
                                      std::string properties_filename) {
  auto dev = HciSocketDevice::Create(socket, properties_filename);
  size_t index = Add(std::static_pointer_cast<Device>(dev));
  std::string addr = "da:4c:10:de:17:";  // Da HCI dev
  std::stringstream stream;
Loading