-
Notifications
You must be signed in to change notification settings - Fork 243
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
feature/media skip indicators #2703
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,6 +358,114 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Canceled) { | |
command->on_event(event); | ||
} | ||
|
||
TEST_F(SetMediaClockRequestTest, MessageWithForwardSeekIndicator_TRACK) { | ||
MessageSharedPtr msg = CreateMsgParams(); | ||
mobile_apis::SeekIndicatorType::eType seek_indicator_type = | ||
mobile_apis::SeekIndicatorType::TRACK; | ||
|
||
(*msg)[am::strings::msg_params][am::strings::forward_seek_indicator] = | ||
seek_indicator_type; | ||
std::shared_ptr<SetMediaClockRequest> command( | ||
CreateCommand<SetMediaClockRequest>(msg)); | ||
|
||
ExpectationsSetupHelper(true); | ||
|
||
command->Run(); | ||
|
||
EXPECT_EQ( | ||
seek_indicator_type, | ||
static_cast<mobile_apis::SeekIndicatorType::eType>( | ||
(*msg)[am::strings::msg_params][am::strings::forward_seek_indicator] | ||
.asInt())); | ||
auto msg_params = (*msg)[am::strings::msg_params]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's better to move this line before first usage of |
||
EXPECT_TRUE(msg_params.keyExists(am::strings::forward_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::back_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::seek_time)); | ||
} | ||
|
||
TEST_F(SetMediaClockRequestTest, MessageWithBackSeekIndicator_TRACK) { | ||
MessageSharedPtr msg = CreateMsgParams(); | ||
mobile_apis::SeekIndicatorType::eType seek_indicator_type = | ||
mobile_apis::SeekIndicatorType::TRACK; | ||
|
||
(*msg)[am::strings::msg_params][am::strings::back_seek_indicator] = | ||
seek_indicator_type; | ||
std::shared_ptr<SetMediaClockRequest> command( | ||
CreateCommand<SetMediaClockRequest>(msg)); | ||
|
||
ExpectationsSetupHelper(true); | ||
|
||
command->Run(); | ||
|
||
EXPECT_EQ( | ||
seek_indicator_type, | ||
static_cast<mobile_apis::SeekIndicatorType::eType>( | ||
(*msg)[am::strings::msg_params][am::strings::back_seek_indicator] | ||
.asInt())); | ||
|
||
auto msg_params = (*msg)[am::strings::msg_params]; | ||
EXPECT_TRUE(msg_params.keyExists(am::strings::back_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::forward_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::seek_time)); | ||
} | ||
|
||
TEST_F(SetMediaClockRequestTest, MessageWithForwardSeekIndicator_TIME) { | ||
MessageSharedPtr msg = CreateMsgParams(); | ||
mobile_apis::SeekIndicatorType::eType seek_indicator_type = | ||
mobile_apis::SeekIndicatorType::TIME; | ||
std::uint32_t seek_time = 10; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For magic numbers it's better to use const. And please use |
||
|
||
auto msg_params = (*msg)[am::strings::msg_params]; | ||
|
||
msg_params[am::strings::forward_seek_indicator] = seek_indicator_type; | ||
msg_params[am::strings::seek_time] = seek_time; | ||
|
||
std::shared_ptr<SetMediaClockRequest> command( | ||
CreateCommand<SetMediaClockRequest>(msg)); | ||
|
||
ExpectationsSetupHelper(true); | ||
|
||
command->Run(); | ||
|
||
EXPECT_TRUE(msg_params.keyExists(am::strings::forward_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::back_seek_indicator)); | ||
|
||
EXPECT_EQ(seek_indicator_type, | ||
static_cast<mobile_apis::SeekIndicatorType::eType>( | ||
msg_params[am::strings::forward_seek_indicator].asInt())); | ||
|
||
EXPECT_TRUE(msg_params.keyExists(am::strings::seek_time)); | ||
EXPECT_EQ(seek_time, msg_params[am::strings::seek_time].asInt()); | ||
} | ||
|
||
TEST_F(SetMediaClockRequestTest, MessageWithBackSeekIndicator_TIME) { | ||
MessageSharedPtr msg = CreateMsgParams(); | ||
mobile_apis::SeekIndicatorType::eType seek_indicator_type = | ||
mobile_apis::SeekIndicatorType::TIME; | ||
std::uint32_t seek_time = 10; | ||
|
||
auto msg_params = (*msg)[am::strings::msg_params]; | ||
|
||
msg_params[am::strings::back_seek_indicator] = seek_indicator_type; | ||
msg_params[am::strings::seek_time] = seek_time; | ||
|
||
std::shared_ptr<SetMediaClockRequest> command( | ||
CreateCommand<SetMediaClockRequest>(msg)); | ||
|
||
ExpectationsSetupHelper(true); | ||
|
||
command->Run(); | ||
|
||
EXPECT_EQ(seek_indicator_type, | ||
static_cast<mobile_apis::SeekIndicatorType::eType>( | ||
msg_params[am::strings::back_seek_indicator].asInt())); | ||
|
||
EXPECT_TRUE(msg_params.keyExists(am::strings::back_seek_indicator)); | ||
EXPECT_FALSE(msg_params.keyExists(am::strings::forward_seek_indicator)); | ||
|
||
EXPECT_TRUE(msg_params.keyExists(am::strings::seek_time)); | ||
EXPECT_EQ(seek_time, msg_params[am::strings::seek_time].asInt()); | ||
} | ||
} // namespace set_media_clock_timer_request | ||
} // namespace mobile_commands_test | ||
} // namespace commands_test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, check the existing of key (using assert) before this expectation