Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnregisterAppInterface for not found app #1572

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,12 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
bool CommandRequestImpl::CheckAllowedParameters() {
LOG4CXX_AUTO_TRACE(logger_);

// RegisterAppInterface should always be allowed
if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
static_cast<mobile_apis::FunctionID::eType>(function_id())) {
// RegisterAppInterface and UnregisterAppInterface should always be allowed
using namespace helpers;
if (Compare<mobile_apis::FunctionID::eType, EQ, ONE>(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
mobile_apis::FunctionID::RegisterAppInterfaceID,
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,26 @@ TEST_F(CommandRequestImplTest,
(*result)[strings::msg_params][strings::info].asString().empty());
}

TEST_F(CommandRequestImplTest, CheckPermissions_UnregisterAppInterface_True) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::UnregisterAppInterfaceID;

CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);

EXPECT_TRUE(command->CheckPermissions());
}

TEST_F(CommandRequestImplTest, CheckPermissions_RegisterAppInterface_True) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::RegisterAppInterfaceID;

CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);

EXPECT_TRUE(command->CheckPermissions());
}

} // namespace command_request_impl
} // namespace commands_test
} // namespace components
Expand Down