summaryrefslogtreecommitdiff
path: root/src/components/protocol_handler
diff options
context:
space:
mode:
authorFrank Ronneburg <fronneburg@xevo.com>2018-07-04 01:33:03 +0900
committerfronneburg <fronneburg@xevo.com>2018-07-04 13:40:34 -0700
commit558bbe28dac48af20aef7ae350d290aaf8dd0d1f (patch)
tree5698c6705721df584960a9c0d3e69d4dc5cfe97c /src/components/protocol_handler
parentbe43a3b8f1fcbd256187fe1076d7980a8bfa4bbf (diff)
downloadsdl_core-558bbe28dac48af20aef7ae350d290aaf8dd0d1f.tar.gz
Merge pull request #296 in NAR/sdl-core from bugfux/handle_review_20180702 to feature/Ford-WiFi
* commit 'dcdc9f62eaa094292332b52846694bcf2a0e591d': fix: remove "2" from audio/videoServiceTransports when secondary transport is disabled and servicesMap is empty
Diffstat (limited to 'src/components/protocol_handler')
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h1
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc17
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc41
3 files changed, 54 insertions, 5 deletions
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index a0fd436f98..fb685f33d3 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -700,6 +700,7 @@ class ProtocolHandlerImpl
std::vector<std::string>& secondaryTransports) const;
void GenerateServiceTransportsForStartSessionAck(
+ bool secondary_enabled,
const std::vector<std::string>& service_transports,
const std::string& primary_connection_type,
const impl::TransportType primary_transport_type,
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index ffbd4b89e0..daad7a3bf1 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -2458,6 +2458,7 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration(
// Next, figure out which connections audio or video services are allowed on
GenerateServiceTransportsForStartSessionAck(
+ settings_.multiple_transports_enabled(),
settings_.audio_service_transports(),
connection_type,
td.transport_type_,
@@ -2465,6 +2466,7 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration(
audioServiceTransports);
GenerateServiceTransportsForStartSessionAck(
+ settings_.multiple_transports_enabled(),
settings_.video_service_transports(),
connection_type,
td.transport_type_,
@@ -2527,6 +2529,7 @@ void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck(
}
void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
+ bool secondary_enabled,
const std::vector<std::string>& service_transports,
const std::string& primary_connection_type,
const impl::TransportType primary_transport_type,
@@ -2535,11 +2538,15 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
LOG4CXX_AUTO_TRACE(logger_);
if (service_transports.size() == 0) {
- LOG4CXX_TRACE(logger_,
- "Empty Service Transports. Allowing service to run on both "
- "connections");
- serviceTransports.push_back(1);
- serviceTransports.push_back(2);
+ if (secondary_enabled) {
+ LOG4CXX_TRACE(logger_,
+ "Empty Service Transports. Allowing service to run on both "
+ "connections");
+ serviceTransports.push_back(1);
+ serviceTransports.push_back(2);
+ } else {
+ serviceTransports.push_back(1);
+ }
} else {
bool fPrimaryAdded = false;
bool fSecondaryAdded = false;
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index f840a3f258..8f95a6d088 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -1985,6 +1985,47 @@ TEST_F(ProtocolHandlerImplTest,
expected_video_service_transports);
}
+TEST_F(
+ ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_SecondaryDisabled_ServicesMapEmpty) {
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth; // empty
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config does not specify video and audio services
+ std::vector<std::string> audio_service_transports; // empty
+ std::vector<std::string> video_service_transports; // empty
+
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ // Core should not offer any secondary transport. It should still send
+ // the video/audio service transport lists.
+ std::vector<std::string> expected_transport_strings; // empty
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ false, /* disabled */
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
// Secondary transport param should not be included for apps with v5.0.0
TEST_F(ProtocolHandlerImplTest,
StartSessionAck_Unprotected_NoSecondaryTransportParamsForV5) {