aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-09-06 06:18:11 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-09-06 06:18:11 +0000
commit9bb33b077bbc2c8d3749048b83cc81df6074b316 (patch)
treec2afd7af738b73e1ef93048e7c49daa82ddf75cc
parent4be194904e31a034dbf22b0017d0e9b5811aff88 (diff)
parentc89875a9da3f0d7414f0ded6bdb35de1c438d7e0 (diff)
downloadbt-9bb33b077bbc2c8d3749048b83cc81df6074b316.tar.gz
Merge "RootCanal: Make property of DUT/CERT device configurable"
-rw-r--r--vendor_libs/test_vendor_lib/desktop/test_environment.cc2
-rw-r--r--vendor_libs/test_vendor_lib/desktop/test_environment.h2
-rw-r--r--vendor_libs/test_vendor_lib/model/devices/hci_socket_device.cc5
-rw-r--r--vendor_libs/test_vendor_lib/model/devices/hci_socket_device.h8
-rw-r--r--vendor_libs/test_vendor_lib/model/setup/test_model.cc6
-rw-r--r--vendor_libs/test_vendor_lib/model/setup/test_model.h3
6 files changed, 16 insertions, 10 deletions
diff --git a/vendor_libs/test_vendor_lib/desktop/test_environment.cc b/vendor_libs/test_vendor_lib/desktop/test_environment.cc
index 3ce484c0c..16896b9a3 100644
--- a/vendor_libs/test_vendor_lib/desktop/test_environment.cc
+++ b/vendor_libs/test_vendor_lib/desktop/test_environment.cc
@@ -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,
diff --git a/vendor_libs/test_vendor_lib/desktop/test_environment.h b/vendor_libs/test_vendor_lib/desktop/test_environment.h
index 590461eaa..6cb41ad73 100644
--- a/vendor_libs/test_vendor_lib/desktop/test_environment.h
+++ b/vendor_libs/test_vendor_lib/desktop/test_environment.h
@@ -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_;
diff --git a/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.cc b/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.cc
index 4a7b179f3..afe1bf22d 100644
--- a/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.cc
+++ b/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.cc
@@ -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);
diff --git a/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.h b/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.h
index 97e46baca..4884b2bf6 100644
--- a/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.h
+++ b/vendor_libs/test_vendor_lib/model/devices/hci_socket_device.h
@@ -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);
}
std::string GetTypeString() const override {
diff --git a/vendor_libs/test_vendor_lib/model/setup/test_model.cc b/vendor_libs/test_vendor_lib/model/setup/test_model.cc
index 3d3dd74a0..e5fcc55c8 100644
--- a/vendor_libs/test_vendor_lib/model/setup/test_model.cc
+++ b/vendor_libs/test_vendor_lib/model/setup/test_model.cc
@@ -212,9 +212,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;
diff --git a/vendor_libs/test_vendor_lib/model/setup/test_model.h b/vendor_libs/test_vendor_lib/model/setup/test_model.h
index bf62eee44..8dca4395a 100644
--- a/vendor_libs/test_vendor_lib/model/setup/test_model.h
+++ b/vendor_libs/test_vendor_lib/model/setup/test_model.h
@@ -82,7 +82,8 @@ class TestModel {
void AddLinkLayerConnection(std::shared_ptr<AsyncDataChannel> socket_fd,
Phy::Type phy_type);
void IncomingLinkLayerConnection(std::shared_ptr<AsyncDataChannel> socket_fd);
- void IncomingHciConnection(std::shared_ptr<AsyncDataChannel> socket_fd);
+ void IncomingHciConnection(std::shared_ptr<AsyncDataChannel> socket_fd,
+ std::string properties_filename = "");
// Handle closed remote connections (both hci & link layer)
void OnConnectionClosed(std::shared_ptr<AsyncDataChannel> socket_fd,