Skip to content

Commit

Permalink
Merge branch 'develop' into feature/sdl_0192_button_subscription_resp…
Browse files Browse the repository at this point in the history
…onse_from_hmi
  • Loading branch information
ychernysheva committed Jul 15, 2021
2 parents 0343ea4 + eaec9b4 commit de6c7aa
Show file tree
Hide file tree
Showing 28 changed files with 331 additions and 106 deletions.
1 change: 0 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Third party contributions are essential for making SDL great. However, we do hav

## Environment
Currently supported:
* Ubuntu Linux 16.04 with GCC 5.4.x
* Ubuntu Linux 18.04 with GCC 7.3.x
* Ubuntu Linux 20.04 with GCC 9.3.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdl_core_github_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
run: git -C ${{ github.workspace }} submodule update --init --recursive
# Install Dependencies
- name: Apt Get Dependencies
run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-6.0
run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-8
- name: Setup CMAKE
uses: jwlawson/actions-setup-cmake@v1.8
with:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Pull Requests Welcome!

## Environment
Currently supported:
* Ubuntu Linux 16.04 with GCC 5.4.x
* Ubuntu Linux 18.04 with GCC 7.5.x
* Ubuntu Linux 20.04 with GCC 9.3.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ CommandCreator& RCCommandFactory::get_mobile_command_creator(
: rc_factory.GetCreator<
commands::GetInteriorVehicleDataConsentResponse>();
}
default: {}
default: {
}
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
Expand All @@ -230,7 +231,8 @@ CommandCreator& RCCommandFactory::get_mobile_notification_creator(
return rc_factory
.GetCreator<commands::OnInteriorVehicleDataNotification>();
}
default: {}
default: {
}
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
Expand Down Expand Up @@ -259,7 +261,8 @@ CommandCreator& RCCommandFactory::get_mobile_creator_factory(
}
break;
}
default: {}
default: {
}
}
return rc_factory.GetCreator<RCInvalidCommand>();
}
Expand Down Expand Up @@ -314,7 +317,9 @@ CommandCreator& RCCommandFactory::get_hmi_creator_factory(
: rc_factory
.GetCreator<commands::RCSetGlobalPropertiesResponse>();
}
default: { return rc_factory.GetCreator<RCInvalidCommand>(); }
default: {
return rc_factory.GetCreator<RCInvalidCommand>();
}
}
}
} // namespace rc_rpc_plugin
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
<< module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); }
default: {
DCHECK_OR_RETURN(false, AcquireResult::IN_USE);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
RemoveAppIdFromNotification();
break;
}
default: { SDL_LOG_ERROR("Unknown system capability type received"); }
default: {
SDL_LOG_ERROR("Unknown system capability type received");
}
}

SendNotificationToMobile(message_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ void OnSystemCapabilityUpdatedNotification::Run() {
msg_params[strings::system_capability][strings::display_capabilities] =
*capabilities;
} break;
default: { SDL_LOG_ERROR("Unknown system capability type"); }
default: {
SDL_LOG_ERROR("Unknown system capability type");
}
}

SDL_LOG_INFO("Sending OnSystemCapabilityUpdated " << capability_type_string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ void RegisterAppInterfaceRequest::FillApplicationParams(
application->set_webengine_projection_enabled(true);
break;
}
default: {}
default: {
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,9 @@ CommandCreator& HMICommandFactory::get_creator_factory(
return factory
.GetCreator<commands::BCOnAppCapabilityUpdatedNotification>();
}
default: { return factory.GetCreator<InvalidCommand>(); }
default: {
return factory.GetCreator<InvalidCommand>();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ CommandCreator& MobileCommandFactory::get_command_creator(
using app_mngr::commands::Command;
return factory.GetCreator<commands::GenericResponse>();
}
default: {}
default: {
}
}
return factory.GetCreator<InvalidCommand>();
}
Expand Down Expand Up @@ -480,7 +481,8 @@ CommandCreator& MobileCommandFactory::get_notification_creator(
case mobile_apis::FunctionID::OnSubtleAlertPressedID: {
return factory.GetCreator<commands::OnSubtleAlertPressedNotification>();
}
default: {}
default: {
}
}
return factory.GetCreator<InvalidCommand>();
}
Expand All @@ -501,7 +503,8 @@ CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator(
return factory
.GetCreator<commands::mobile::OnAppCapabilityUpdatedNotification>();
}
default: {}
default: {
}
}
return factory.GetCreator<InvalidCommand>();
}
Expand Down Expand Up @@ -532,7 +535,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
break;
}
default: {}
default: {
}
}
CommandCreatorFactory factory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
#include "mobile/get_system_capability_request.h"

#include "application_manager/commands/command_request_test.h"
#include "application_manager/message_helper.h"
#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
#include "resumption/last_state_impl.h"
#include "resumption/last_state_wrapper_impl.h"
#include "smart_objects/smart_object.h"

namespace test {
Expand All @@ -44,8 +47,11 @@ namespace mobile_commands_test {
namespace get_system_capability_request_test {

using sdl_rpc_plugin::commands::GetSystemCapabilityRequest;
using ::test::components::application_manager_test::MockAppServiceManager;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnPointee;

typedef std::shared_ptr<GetSystemCapabilityRequest>
GetSystemCapabilityRequestPtr;

Expand All @@ -64,13 +70,21 @@ class GetSystemCapabilityRequestTest
command_ = CreateCommand<GetSystemCapabilityRequest>(message_);
mock_app_ = CreateMockApp();

last_state_ = std::make_shared<resumption::LastStateWrapperImpl>(
std::make_shared<resumption::LastStateImpl>("app_storage_folder",
"app_info_storage"));
mock_app_service_mngr_ =
std::make_shared<MockAppServiceManager>(app_mngr_, last_state_);

ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
}

GetSystemCapabilityRequestPtr command_;
MessageSharedPtr message_;
MockAppPtr mock_app_;
std::shared_ptr<MockAppServiceManager> mock_app_service_mngr_;
resumption::LastStateWrapperPtr last_state_;
};

TEST_F(
Expand Down Expand Up @@ -117,6 +131,186 @@ TEST_F(
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_AppNotRegistered) {
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::APPLICATION_NOT_REGISTERED),
Command::CommandSource::SOURCE_SDL));
ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_NAVIGATION_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::NAVIGATION;

smart_objects::SmartObjectSPtr system_navigation_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, navigation_capability())
.Times(2)
.WillRepeatedly(Return(system_navigation_capabilities));

ON_CALL(app_mngr_, GetAppServiceManager())
.WillByDefault(ReturnPointee(mock_app_service_mngr_));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_PHONECALL_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::PHONE_CALL;

smart_objects::SmartObjectSPtr system_phonecall_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, phone_capability())
.Times(2)
.WillRepeatedly(Return(system_phonecall_capabilities));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_VIDEOSTREAMING_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::VIDEO_STREAMING;

smart_objects::SmartObjectSPtr system_videostreaming_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, video_streaming_capability())
.Times(2)
.WillRepeatedly(Return(system_videostreaming_capabilities));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_REMOTECONTROL_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::REMOTE_CONTROL;

EXPECT_CALL(*mock_app_, is_remote_control_supported()).WillOnce(Return(true));
EXPECT_CALL(mock_hmi_capabilities_, is_rc_cooperating())
.WillOnce(Return(true));

smart_objects::SmartObjectSPtr system_remotecontrol_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
.Times(2)
.WillRepeatedly(Return(system_remotecontrol_capabilities));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_REMOTECONTROL_DISALLOWEDResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::REMOTE_CONTROL;

EXPECT_CALL(*mock_app_, is_remote_control_supported())
.WillOnce(Return(false));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::DISALLOWED),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_APPSERVICES_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::APP_SERVICES;

ON_CALL(app_mngr_, GetAppServiceManager())
.WillByDefault(ReturnPointee(mock_app_service_mngr_));

std::vector<smart_objects::SmartObject> app_services;
EXPECT_CALL(*mock_app_service_mngr_, GetAllServiceRecords())
.WillOnce(Return(app_services));

ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
CreateAppServiceCapabilities(app_services))
.WillByDefault(Return(smart_objects::SmartObject()));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_SEATLOCATION_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::SEAT_LOCATION;

smart_objects::SmartObjectSPtr system_seatlocation_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, seat_location_capability())
.Times(2)
.WillRepeatedly(Return(system_seatlocation_capabilities));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

TEST_F(GetSystemCapabilityRequestTest,
Run_GetSystemDisplayCapabilities_DRIVERDISTRACTION_SUCCESSResultCode) {
(*message_)[strings::msg_params][strings::system_capability_type] =
mobile_apis::SystemCapabilityType::DRIVER_DISTRACTION;

smart_objects::SmartObjectSPtr system_driverdistraction_capabilities(
std::make_shared<smart_objects::SmartObject>());
EXPECT_CALL(mock_hmi_capabilities_, driver_distraction_capability())
.Times(2)
.WillRepeatedly(Return(system_driverdistraction_capabilities));

EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
Command::CommandSource::SOURCE_SDL));

ASSERT_TRUE(command_->Init());
command_->Run();
}

} // namespace get_system_capability_request_test
} // namespace mobile_commands_test
} // namespace commands_test
Expand Down
Loading

0 comments on commit de6c7aa

Please sign in to comment.