Updated StreamData Matchers to Use Matchers

Updated all the stream data matcher we use in our unit tests
to allow us to use matchers in them. We are now able to use "_"
to ignore specific parameters.

With this we were able to replace the different version of
matchers for each stream data type with a single instance for
each type.

Includes updates to printing strings to the listener. Strings
now go through a "pretty" function to help make it easier to
read them in the output.

Change-Id: I146351b54fccd63ab9ec936877e6c6b30f9aa9fc
This commit is contained in:
Aaron Vaage 2018-05-25 10:41:02 -07:00
parent 440adb3086
commit fbc4952e21
8 changed files with 326 additions and 214 deletions

View File

@ -66,6 +66,49 @@ std::string BoolToString(bool value) {
return value ? "true" : "false"; return value ? "true" : "false";
} }
bool TryMatchStreamDataType(const StreamDataType& actual,
const StreamDataType& expected,
::testing::MatchResultListener* listener) {
if (actual != expected) {
std::string expected_as_string = StreamDataTypeToString(expected);
std::string actual_as_string = StreamDataTypeToString(actual);
*listener << "which is " << actual_as_string << " (expected "
<< expected_as_string << ")";
return false;
}
return true;
}
std::string ToPrettyString(const std::string& str) {
std::string out;
// Opening quotation.
out.push_back('"');
for (char c : str) {
if (isspace(c)) {
// Make all white space characters spaces to avoid print issues in
// the terminal.
out.push_back(' ');
} else if (isalnum(c)) {
// If the character is alpha-numeric, then print it as is. Just using
// these characters, it should be enough to understand the string.
out.push_back(c);
} else {
// Replace all other characters with '.'. This is to avoid print issues
// (e.g. \n) or readability issues (e.g. ").
out.push_back('.');
}
}
// Closing quotation.
out.push_back('"');
return out;
}
bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const { bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const {
return true; return true;
} }

View File

@ -17,42 +17,49 @@ namespace shaka {
namespace media { namespace media {
std::string BoolToString(bool value); std::string BoolToString(bool value);
std::string ToPrettyString(const std::string& str);
MATCHER_P(IsStreamInfo, stream_index, "") { bool TryMatchStreamDataType(const StreamDataType& actual,
return arg->stream_index == stream_index && const StreamDataType& expected,
arg->stream_data_type == StreamDataType::kStreamInfo; ::testing::MatchResultListener* listener);
}
MATCHER_P3(IsStreamInfo, stream_index, time_scale, encrypted, "") { template <typename T, typename M>
if (arg->stream_data_type != StreamDataType::kStreamInfo) { bool TryMatch(const T& value,
*result_listener << "which is " const M& matcher,
<< StreamDataTypeToString(arg->stream_data_type); ::testing::MatchResultListener* listener,
const char* value_name) {
if (!ExplainMatchResult(matcher, value, listener)) {
// Need a space at the start of the string in the case that
// it gets combined with another string.
*listener << " Mismatch on " << value_name;
return false; return false;
} }
*result_listener << "which is (" << arg->stream_index << "," return true;
<< arg->stream_info->time_scale() << ","
<< BoolToString(arg->stream_info->is_encrypted()) << ")";
return arg->stream_index == stream_index &&
arg->stream_info->time_scale() == time_scale &&
arg->stream_info->is_encrypted() == encrypted;
} }
MATCHER_P4(IsStreamInfo, stream_index, time_scale, encrypted, language, "") { MATCHER_P4(IsStreamInfo, stream_index, time_scale, encrypted, language, "") {
if (arg->stream_data_type != StreamDataType::kStreamInfo) { if (!TryMatchStreamDataType(arg->stream_data_type,
*result_listener << "which is " StreamDataType::kStreamInfo, result_listener)) {
<< StreamDataTypeToString(arg->stream_data_type);
return false; return false;
} }
*result_listener << "which is (" << arg->stream_index << "," const std::string is_encrypted_string =
<< arg->stream_info->time_scale() << "," BoolToString(arg->stream_info->is_encrypted());
<< BoolToString(arg->stream_info->is_encrypted()) << ","
*result_listener << "which is (" << arg->stream_index << ", "
<< arg->stream_info->time_scale() << ", "
<< is_encrypted_string << ", "
<< arg->stream_info->language() << ")"; << arg->stream_info->language() << ")";
return arg->stream_index == stream_index &&
arg->stream_info->time_scale() == time_scale && return TryMatch(arg->stream_index, stream_index, result_listener,
arg->stream_info->is_encrypted() == encrypted && "stream_index") &&
arg->stream_info->language() == language; TryMatch(arg->stream_info->time_scale(), time_scale, result_listener,
"time_scale") &&
TryMatch(arg->stream_info->is_encrypted(), encrypted, result_listener,
"is_encrypted") &&
TryMatch(arg->stream_info->language(), language, result_listener,
"language");
} }
MATCHER_P5(IsSegmentInfo, MATCHER_P5(IsSegmentInfo,
@ -62,22 +69,32 @@ MATCHER_P5(IsSegmentInfo,
subsegment, subsegment,
encrypted, encrypted,
"") { "") {
if (arg->stream_data_type != StreamDataType::kSegmentInfo) { if (!TryMatchStreamDataType(arg->stream_data_type,
*result_listener << "which is " StreamDataType::kSegmentInfo, result_listener)) {
<< StreamDataTypeToString(arg->stream_data_type);
return false; return false;
} }
*result_listener << "which is (" << arg->stream_index << "," const std::string is_subsegment_string =
<< arg->segment_info->start_timestamp << "," BoolToString(arg->segment_info->is_subsegment);
<< arg->segment_info->duration << "," const std::string is_encrypted_string =
<< BoolToString(arg->segment_info->is_subsegment) << "," BoolToString(arg->segment_info->is_encrypted);
<< BoolToString(arg->segment_info->is_encrypted) << ")";
return arg->stream_index == stream_index && *result_listener << "which is (" << arg->stream_index << ", "
arg->segment_info->start_timestamp == start_timestamp && << arg->segment_info->start_timestamp << ", "
arg->segment_info->duration == duration && << arg->segment_info->duration << ", "
arg->segment_info->is_subsegment == subsegment && << is_subsegment_string << ", " << is_encrypted_string
arg->segment_info->is_encrypted == encrypted; << ")";
return TryMatch(arg->stream_index, stream_index, result_listener,
"stream_index") &&
TryMatch(arg->segment_info->start_timestamp, start_timestamp,
result_listener, "start_timestamp") &&
TryMatch(arg->segment_info->duration, duration, result_listener,
"duration") &&
TryMatch(arg->segment_info->is_subsegment, subsegment, result_listener,
"is_subsegment") &&
TryMatch(arg->segment_info->is_encrypted, encrypted, result_listener,
"is_encrypted");
} }
MATCHER_P6(MatchEncryptionConfig, MATCHER_P6(MatchEncryptionConfig,
@ -88,66 +105,105 @@ MATCHER_P6(MatchEncryptionConfig,
constant_iv, constant_iv,
key_id, key_id,
"") { "") {
*result_listener << "which is (" << FourCCToString(arg.protection_scheme) const std::string constant_iv_hex =
<< "," << static_cast<int>(arg.crypt_byte_block) << "," base::HexEncode(arg.constant_iv.data(), arg.constant_iv.size());
<< static_cast<int>(arg.skip_byte_block) << "," const std::string key_id_hex =
<< static_cast<int>(arg.per_sample_iv_size) << "," base::HexEncode(arg.key_id.data(), arg.key_id.size());
<< base::HexEncode(arg.constant_iv.data(), const std::string protection_scheme_as_string =
arg.constant_iv.size()) FourCCToString(arg.protection_scheme);
<< "," // Convert to integers so that they will print as a number and not a uint8_t
<< base::HexEncode(arg.key_id.data(), arg.key_id.size()) // (char).
<< ")"; const int crypt_byte_as_int = static_cast<int>(arg.crypt_byte_block);
return arg.protection_scheme == protection_scheme && const int skip_byte_as_int = static_cast<int>(arg.skip_byte_block);
arg.crypt_byte_block == crypt_byte_block &&
arg.skip_byte_block == skip_byte_block && *result_listener << "which is (" << protection_scheme_as_string << ", "
arg.per_sample_iv_size == per_sample_iv_size && << crypt_byte_as_int << ", " << skip_byte_as_int << ", "
arg.constant_iv == constant_iv && arg.key_id == key_id; << arg.per_sample_iv_size << ", " << constant_iv_hex << ", "
<< key_id_hex << ")";
return TryMatch(arg.protection_scheme, protection_scheme, result_listener,
"protection_scheme") &&
TryMatch(arg.crypt_byte_block, crypt_byte_block, result_listener,
"crypt_byte_block") &&
TryMatch(arg.skip_byte_block, skip_byte_block, result_listener,
"skip_byte_block") &&
TryMatch(arg.per_sample_iv_size, per_sample_iv_size, result_listener,
"per_sample_iv_size") &&
TryMatch(arg.constant_iv, constant_iv, result_listener,
"constant_iv") &&
TryMatch(arg.key_id, key_id, result_listener, "key_id");
} }
MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") { MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") {
if (arg->stream_data_type != StreamDataType::kMediaSample) { if (!TryMatchStreamDataType(arg->stream_data_type,
*result_listener << "which is " StreamDataType::kMediaSample, result_listener)) {
<< StreamDataTypeToString(arg->stream_data_type);
return false; return false;
} }
*result_listener << "which is (" << arg->stream_index << ","
<< arg->media_sample->dts() << "," const std::string is_encrypted_string =
<< arg->media_sample->duration() << "," BoolToString(arg->media_sample->is_encrypted());
<< BoolToString(arg->media_sample->is_encrypted()) << ")";
return arg->stream_index == stream_index && *result_listener << "which is (" << arg->stream_index << ", "
arg->media_sample->dts() == static_cast<int64_t>(timestamp) && << arg->media_sample->dts() << ", "
arg->media_sample->duration() == static_cast<int64_t>(duration) && << arg->media_sample->duration() << ", "
arg->media_sample->is_encrypted() == encrypted; << is_encrypted_string << ")";
return TryMatch(arg->stream_index, stream_index, result_listener,
"stream_index") &&
TryMatch(arg->media_sample->dts(), timestamp, result_listener,
"dts") &&
TryMatch(arg->media_sample->duration(), duration, result_listener,
"duration") &&
TryMatch(arg->media_sample->is_encrypted(), encrypted, result_listener,
"is_encrypted");
} }
MATCHER_P5(IsTextSample, id, start_time, end_time, settings, payload, "") { MATCHER_P6(IsTextSample,
if (arg->stream_data_type != StreamDataType::kTextSample) { stream_index,
*result_listener << "which is " id,
<< StreamDataTypeToString(arg->stream_data_type); start_time,
end_time,
settings,
payload,
"") {
if (!TryMatchStreamDataType(arg->stream_data_type,
StreamDataType::kTextSample, result_listener)) {
return false; return false;
} }
*result_listener << "which is (" << arg->text_sample->id() << ","
<< arg->text_sample->start_time() << "," *result_listener << "which is (" << arg->stream_index << ", "
<< arg->text_sample->EndTime() << "," << ToPrettyString(arg->text_sample->id()) << ", "
<< arg->text_sample->settings() << "," << arg->text_sample->start_time() << ", "
<< arg->text_sample->payload() << ")"; << arg->text_sample->EndTime() << ", "
return arg->text_sample->id() == id && << ToPrettyString(arg->text_sample->settings()) << ", "
arg->text_sample->start_time() == start_time && << ToPrettyString(arg->text_sample->payload()) << ")";
arg->text_sample->EndTime() == end_time &&
arg->text_sample->settings() == settings && return TryMatch(arg->stream_index, stream_index, result_listener,
arg->text_sample->payload() == payload; "stream_index") &&
TryMatch(arg->text_sample->id(), id, result_listener, "id") &&
TryMatch(arg->text_sample->start_time(), start_time, result_listener,
"start_time") &&
TryMatch(arg->text_sample->EndTime(), end_time, result_listener,
"EndTime") &&
TryMatch(arg->text_sample->settings(), settings, result_listener,
"settings") &&
TryMatch(arg->text_sample->payload(), payload, result_listener,
"payload");
} }
MATCHER_P2(IsCueEvent, stream_index, time_in_seconds, "") { MATCHER_P2(IsCueEvent, stream_index, time_in_seconds, "") {
if (arg->stream_data_type != StreamDataType::kCueEvent) { if (!TryMatchStreamDataType(arg->stream_data_type, StreamDataType::kCueEvent,
*result_listener << "which is " result_listener)) {
<< StreamDataTypeToString(arg->stream_data_type);
return false; return false;
} }
*result_listener << "which is (" << arg->stream_index << ","
*result_listener << "which is (" << arg->stream_index << ", "
<< arg->cue_event->time_in_seconds << ")"; << arg->cue_event->time_in_seconds << ")";
return arg->stream_index == stream_index &&
arg->cue_event->time_in_seconds == time_in_seconds; return TryMatch(arg->stream_index, stream_index, result_listener,
"stream_index") &&
TryMatch(arg->cue_event->time_in_seconds, time_in_seconds,
result_listener, "time_in_seconds");
} }
class FakeInputMediaHandler : public MediaHandler { class FakeInputMediaHandler : public MediaHandler {

View File

@ -12,6 +12,7 @@
#include "packager/media/base/media_handler_test_base.h" #include "packager/media/base/media_handler_test_base.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
using ::testing::_;
using ::testing::ElementsAre; using ::testing::ElementsAre;
using ::testing::IsEmpty; using ::testing::IsEmpty;
@ -58,7 +59,7 @@ TEST_F(ChunkingHandlerTest, AudioNoSubsegmentsThenFlush) {
kStreamIndex, GetAudioStreamInfo(kTimeScale0)))); kStreamIndex, GetAudioStreamInfo(kTimeScale0))));
EXPECT_THAT( EXPECT_THAT(
GetOutputStreamDataVector(), GetOutputStreamDataVector(),
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted))); ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted, _)));
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
ClearOutputStreamDataVector(); ClearOutputStreamDataVector();
@ -101,7 +102,7 @@ TEST_F(ChunkingHandlerTest, AudioWithSubsegments) {
EXPECT_THAT( EXPECT_THAT(
GetOutputStreamDataVector(), GetOutputStreamDataVector(),
ElementsAre( ElementsAre(
IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted), IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted, _),
IsMediaSample(kStreamIndex, 0, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, 0, kDuration, !kEncrypted),
IsMediaSample(kStreamIndex, kDuration, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, kDuration, kDuration, !kEncrypted),
IsSegmentInfo(kStreamIndex, 0, kDuration * 2, kIsSubsegment, IsSegmentInfo(kStreamIndex, 0, kDuration * 2, kIsSubsegment,
@ -132,7 +133,7 @@ TEST_F(ChunkingHandlerTest, VideoAndSubsegmentAndNonzeroStart) {
EXPECT_THAT( EXPECT_THAT(
GetOutputStreamDataVector(), GetOutputStreamDataVector(),
ElementsAre( ElementsAre(
IsStreamInfo(kStreamIndex, kTimeScale1, !kEncrypted), IsStreamInfo(kStreamIndex, kTimeScale1, !kEncrypted, _),
// The first samples @ kStartTimestamp is discarded - not key frame. // The first samples @ kStartTimestamp is discarded - not key frame.
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration,
kDuration, !kEncrypted), kDuration, !kEncrypted),

View File

@ -15,6 +15,7 @@
#include "packager/status_macros.h" #include "packager/status_macros.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
using ::testing::_;
using ::testing::ElementsAre; using ::testing::ElementsAre;
using ::testing::IsEmpty; using ::testing::IsEmpty;
@ -30,7 +31,7 @@ const size_t kThreeOutput = 3;
const bool kEncrypted = true; const bool kEncrypted = true;
const bool kKeyFrame = true; const bool kKeyFrame = true;
const uint64_t kMsTimeScale = 1000; const uint32_t kMsTimeScale = 1000;
const char* kNoId = ""; const char* kNoId = "";
const char* kNoSettings = ""; const char* kNoSettings = "";
@ -87,7 +88,7 @@ TEST_F(CueAlignmentHandlerTest, VideoInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -131,7 +132,7 @@ TEST_F(CueAlignmentHandlerTest, AudioInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -179,15 +180,15 @@ TEST_F(CueAlignmentHandlerTest, TextInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, OnProcess(IsTextSample(_, kNoId, kSample0Start, kSample0End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample1Start, kSample1End, OnProcess(IsTextSample(_, kNoId, kSample1Start, kSample1End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample2Start, kSample2End, OnProcess(IsTextSample(_, kNoId, kSample2Start, kSample2End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), OnFlush(kParent)); EXPECT_CALL(*Output(kTextStream), OnFlush(kParent));
} }
@ -229,15 +230,15 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, OnProcess(IsTextSample(_, kNoId, kSample0Start, kSample0End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample1Start, kSample1End, OnProcess(IsTextSample(_, kNoId, kSample1Start, kSample1End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample2Start, kSample2End, OnProcess(IsTextSample(_, kNoId, kSample2Start, kSample2End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), OnFlush(kParent)); EXPECT_CALL(*Output(kTextStream), OnFlush(kParent));
} }
@ -246,7 +247,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -263,7 +264,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -353,7 +354,7 @@ TEST_F(CueAlignmentHandlerTest, VideoInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -407,7 +408,7 @@ TEST_F(CueAlignmentHandlerTest, AudioInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -465,17 +466,17 @@ TEST_F(CueAlignmentHandlerTest, TextInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, OnProcess(IsTextSample(_, kNoId, kSample0Start, kSample0End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsCueEvent(kParent, kSample1StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample1StartInSeconds)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample1Start, kSample1End, OnProcess(IsTextSample(_, kNoId, kSample1Start, kSample1End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample2Start, kSample2End, OnProcess(IsTextSample(_, kNoId, kSample2Start, kSample2End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), OnFlush(kParent)); EXPECT_CALL(*Output(kTextStream), OnFlush(kParent));
} }
@ -524,15 +525,15 @@ TEST_F(CueAlignmentHandlerTest, TextInputWithCueAfterLastStart) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, OnProcess(IsTextSample(_, kNoId, kSample0Start, kSample0End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample1Start, kSample1End, OnProcess(IsTextSample(_, kNoId, kSample1Start, kSample1End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample2Start, kSample2End, OnProcess(IsTextSample(_, kNoId, kSample2Start, kSample2End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsCueEvent(kParent, kCueTimeInSeconds))); OnProcess(IsCueEvent(kParent, kCueTimeInSeconds)));
@ -585,17 +586,17 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, OnProcess(IsTextSample(_, kNoId, kSample0Start, kSample0End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample1Start, kSample1End, OnProcess(IsTextSample(_, kNoId, kSample1Start, kSample1End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsCueEvent(kParent, kSample2StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample2StartInSeconds)));
EXPECT_CALL(*Output(kTextStream), EXPECT_CALL(*Output(kTextStream),
OnProcess(IsTextSample(kNoId, kSample2Start, kSample2End, OnProcess(IsTextSample(_, kNoId, kSample2Start, kSample2End,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kTextStream), OnFlush(kParent)); EXPECT_CALL(*Output(kTextStream), OnFlush(kParent));
} }
@ -604,7 +605,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));
@ -623,7 +624,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted)));

View File

@ -11,6 +11,8 @@
#include "packager/media/chunking/text_chunker.h" #include "packager/media/chunking/text_chunker.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
using ::testing::_;
namespace shaka { namespace shaka {
namespace media { namespace media {
@ -67,10 +69,11 @@ TEST_F(TextChunkerTest, SampleEndingOnSegmentStart) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -117,11 +120,12 @@ TEST_F(TextChunkerTest, CreatesSegmentsForSamples) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment One // Segment One
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -130,7 +134,7 @@ TEST_F(TextChunkerTest, CreatesSegmentsForSamples) {
// Segment Two // Segment Two
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -182,11 +186,12 @@ TEST_F(TextChunkerTest, OutputsEmptySegments) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment One // Segment One
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -201,7 +206,7 @@ TEST_F(TextChunkerTest, OutputsEmptySegments) {
// Segment Three // Segment Three
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,
@ -248,11 +253,12 @@ TEST_F(TextChunkerTest, SampleCrossesSegments) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment One // Segment One
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -261,7 +267,7 @@ TEST_F(TextChunkerTest, SampleCrossesSegments) {
// Segment Two // Segment Two
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -318,18 +324,19 @@ TEST_F(TextChunkerTest, PreservesOrder) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment One // Segment One
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleAId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kSampleAId, kSampleAStart,
kNoSettings, kNoPayload))); kSampleAEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleBId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kSampleBId, kSampleBStart,
kNoSettings, kNoPayload))); kSampleBEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleCId, kSampleCStart, kSampleCEnd, OnProcess(IsTextSample(_, kSampleCId, kSampleCStart,
kNoSettings, kNoPayload))); kSampleCEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
kSegmentDurationMs, !kSubSegment, kSegmentDurationMs, !kSubSegment,
@ -337,14 +344,14 @@ TEST_F(TextChunkerTest, PreservesOrder) {
// Segment Two // Segment Two
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleAId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kSampleAId, kSampleAStart,
kNoSettings, kNoPayload))); kSampleAEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleBId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kSampleBId, kSampleBStart,
kNoSettings, kNoPayload))); kSampleBEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleCId, kSampleCStart, kSampleCEnd, OnProcess(IsTextSample(_, kSampleCId, kSampleCStart,
kNoSettings, kNoPayload))); kSampleCEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
kSegmentDurationMs, !kSubSegment, kSegmentDurationMs, !kSubSegment,
@ -352,8 +359,8 @@ TEST_F(TextChunkerTest, PreservesOrder) {
// Segment Two // Segment Two
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kSampleCId, kSampleCStart, kSampleCEnd, OnProcess(IsTextSample(_, kSampleCId, kSampleCStart,
kNoSettings, kNoPayload))); kSampleCEnd, kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,
kSegmentDurationMs, !kSubSegment, kSegmentDurationMs, !kSubSegment,
@ -409,11 +416,12 @@ TEST_F(TextChunkerTest, NestedSamples) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment 0 // Segment 0
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -422,10 +430,10 @@ TEST_F(TextChunkerTest, NestedSamples) {
// Segment 1 // Segment 1
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -434,10 +442,10 @@ TEST_F(TextChunkerTest, NestedSamples) {
// Segment 2 // Segment 2
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,
@ -446,10 +454,10 @@ TEST_F(TextChunkerTest, NestedSamples) {
// Segment 3 // Segment 3
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment3Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment3Start,
@ -458,7 +466,7 @@ TEST_F(TextChunkerTest, NestedSamples) {
// Segment 4 // Segment 4
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment4Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment4Start,
@ -510,11 +518,12 @@ TEST_F(TextChunkerTest, SecondSampleStartsAfterMultiSegmentSampleEnds) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment One // Segment One
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -523,7 +532,7 @@ TEST_F(TextChunkerTest, SecondSampleStartsAfterMultiSegmentSampleEnds) {
// Segment Two // Segment Two
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -532,7 +541,7 @@ TEST_F(TextChunkerTest, SecondSampleStartsAfterMultiSegmentSampleEnds) {
// Segment Three // Segment Three
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleBStart, kSampleBEnd, OnProcess(IsTextSample(_, kNoId, kSampleBStart, kSampleBEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,
@ -589,11 +598,12 @@ TEST_F(TextChunkerTest, SampleSpanningMultipleCues) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutput), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Output(kOutput),
OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Segment 0 and Cue 0 // Segment 0 and Cue 0
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment0Start,
@ -603,7 +613,7 @@ TEST_F(TextChunkerTest, SampleSpanningMultipleCues) {
// Segment 1 and Cue 1 // Segment 1 and Cue 1
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -613,7 +623,7 @@ TEST_F(TextChunkerTest, SampleSpanningMultipleCues) {
// Segment 2 // Segment 2
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsTextSample(kNoId, kSampleAStart, kSampleAEnd, OnProcess(IsTextSample(_, kNoId, kSampleAStart, kSampleAEnd,
kNoSettings, kNoPayload))); kNoSettings, kNoPayload)));
EXPECT_CALL(*Output(kOutput), EXPECT_CALL(*Output(kOutput),
OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,

View File

@ -480,8 +480,9 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithNoKeyRotation) {
kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_)))); kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_))));
} }
EXPECT_THAT(GetOutputStreamDataVector(), EXPECT_THAT(
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted))); GetOutputStreamDataVector(),
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted, _)));
const StreamInfo* stream_info = const StreamInfo* stream_info =
GetOutputStreamDataVector().back()->stream_info.get(); GetOutputStreamDataVector().back()->stream_info.get();
ASSERT_TRUE(stream_info); ASSERT_TRUE(stream_info);
@ -503,8 +504,8 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithNoKeyRotation) {
kStreamIndex, GetMediaSample(i * kSegmentDuration, kSegmentDuration, kStreamIndex, GetMediaSample(i * kSegmentDuration, kSegmentDuration,
kIsKeyFrame, kData, kDataSize)))); kIsKeyFrame, kData, kDataSize))));
ASSERT_OK(Process(StreamData::FromSegmentInfo( ASSERT_OK(Process(StreamData::FromSegmentInfo(
kStreamIndex, kStreamIndex, GetSegmentInfo(i * kSegmentDuration, kSegmentDuration,
GetSegmentInfo(i * kSegmentDuration, kSegmentDuration, !kIsSubsegment)))); !kIsSubsegment))));
const bool is_encrypted = i == 2; const bool is_encrypted = i == 2;
const auto& output_stream_data = GetOutputStreamDataVector(); const auto& output_stream_data = GetOutputStreamDataVector();
EXPECT_THAT(output_stream_data, EXPECT_THAT(output_stream_data,
@ -540,8 +541,9 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithKeyRotation) {
kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_)))); kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_))));
} }
EXPECT_THAT(GetOutputStreamDataVector(), EXPECT_THAT(
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted))); GetOutputStreamDataVector(),
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted, _)));
const StreamInfo* stream_info = const StreamInfo* stream_info =
GetOutputStreamDataVector().back()->stream_info.get(); GetOutputStreamDataVector().back()->stream_info.get();
ASSERT_TRUE(stream_info); ASSERT_TRUE(stream_info);
@ -570,8 +572,8 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithKeyRotation) {
kStreamIndex, GetMediaSample(i * kSegmentDuration, kSegmentDuration, kStreamIndex, GetMediaSample(i * kSegmentDuration, kSegmentDuration,
kIsKeyFrame, kData, kDataSize)))); kIsKeyFrame, kData, kDataSize))));
ASSERT_OK(Process(StreamData::FromSegmentInfo( ASSERT_OK(Process(StreamData::FromSegmentInfo(
kStreamIndex, kStreamIndex, GetSegmentInfo(i * kSegmentDuration, kSegmentDuration,
GetSegmentInfo(i * kSegmentDuration, kSegmentDuration, !kIsSubsegment)))); !kIsSubsegment))));
const bool is_encrypted = i >= 2; const bool is_encrypted = i >= 2;
const auto& output_stream_data = GetOutputStreamDataVector(); const auto& output_stream_data = GetOutputStreamDataVector();
EXPECT_THAT(output_stream_data, EXPECT_THAT(output_stream_data,
@ -610,8 +612,9 @@ TEST_P(EncryptionHandlerEncryptionTest, Encrypt) {
kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_)))); kStreamIndex, GetAudioStreamInfo(kTimeScale, codec_))));
} }
EXPECT_THAT(GetOutputStreamDataVector(), EXPECT_THAT(
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted))); GetOutputStreamDataVector(),
ElementsAre(IsStreamInfo(kStreamIndex, kTimeScale, kEncrypted, _)));
const StreamInfo* stream_info = const StreamInfo* stream_info =
GetOutputStreamDataVector().back()->stream_info.get(); GetOutputStreamDataVector().back()->stream_info.get();
ASSERT_TRUE(stream_info); ASSERT_TRUE(stream_info);
@ -697,8 +700,7 @@ INSTANTIATE_TEST_CASE_P(AppleSampleAes,
class EncryptionHandlerTrackTypeTest : public EncryptionHandlerTest { class EncryptionHandlerTrackTypeTest : public EncryptionHandlerTest {
public: public:
void SetUp() override { void SetUp() override {}
}
}; };
TEST_F(EncryptionHandlerTrackTypeTest, AudioTrackType) { TEST_F(EncryptionHandlerTrackTypeTest, AudioTrackType) {
@ -716,8 +718,7 @@ TEST_F(EncryptionHandlerTrackTypeTest, AudioTrackType) {
.WillOnce( .WillOnce(
DoAll(SetArgPointee<1>(GetMockEncryptionKey()), Return(Status::OK))); DoAll(SetArgPointee<1>(GetMockEncryptionKey()), Return(Status::OK)));
ASSERT_OK(Process(StreamData::FromStreamInfo( ASSERT_OK(Process(StreamData::FromStreamInfo(
kStreamIndex, kStreamIndex, GetAudioStreamInfo(kTimeScale))));
GetAudioStreamInfo(kTimeScale))));
EXPECT_EQ(EncryptionParams::EncryptedStreamAttributes::kAudio, EXPECT_EQ(EncryptionParams::EncryptedStreamAttributes::kAudio,
captured_stream_attributes.stream_type); captured_stream_attributes.stream_type);
} }
@ -739,8 +740,7 @@ TEST_F(EncryptionHandlerTrackTypeTest, VideoTrackType) {
.WillOnce( .WillOnce(
DoAll(SetArgPointee<1>(GetMockEncryptionKey()), Return(Status::OK))); DoAll(SetArgPointee<1>(GetMockEncryptionKey()), Return(Status::OK)));
ASSERT_OK(Process(StreamData::FromStreamInfo( ASSERT_OK(Process(StreamData::FromStreamInfo(
kStreamIndex, kStreamIndex, GetVideoStreamInfo(kTimeScale, kWidth, kHeight))));
GetVideoStreamInfo(kTimeScale, kWidth, kHeight))));
EXPECT_EQ(EncryptionParams::EncryptedStreamAttributes::kVideo, EXPECT_EQ(EncryptionParams::EncryptedStreamAttributes::kVideo,
captured_stream_attributes.stream_type); captured_stream_attributes.stream_type);
EXPECT_EQ(captured_stream_attributes.oneof.video.width, kWidth); EXPECT_EQ(captured_stream_attributes.oneof.video.width, kWidth);

View File

@ -13,6 +13,8 @@
#include "packager/media/formats/webvtt/webvtt_parser.h" #include "packager/media/formats/webvtt/webvtt_parser.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
using ::testing::_;
namespace shaka { namespace shaka {
namespace media { namespace media {
namespace { namespace {
@ -21,8 +23,7 @@ const size_t kInputCount = 0;
const size_t kOutputCount = 1; const size_t kOutputCount = 1;
const size_t kOutputIndex = 0; const size_t kOutputIndex = 0;
const size_t kStreamIndex = 0; const uint32_t kTimeScale = 1000;
const size_t kTimeScale = 1000;
const bool kEncrypted = true; const bool kEncrypted = true;
const char* kNoId = ""; const char* kNoId = "";
@ -71,9 +72,8 @@ TEST_F(WebVttParserTest, ParseOnlyHeader) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted, OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, kLanguage)));
kLanguage))); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -89,8 +89,8 @@ TEST_F(WebVttParserTest, ParseHeaderWithBOM) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -142,8 +142,8 @@ TEST_F(WebVttParserTest, ParserDoesNotDieOnRegionBlock) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -166,8 +166,8 @@ TEST_F(WebVttParserTest, ParserDoesNotDieOnStyleBlock) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -185,8 +185,8 @@ TEST_F(WebVttParserTest, IngoresZeroDurationCues) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -204,11 +204,11 @@ TEST_F(WebVttParserTest, ParseOneCue) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 60000u, 3600000u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 60000u, 3600000u, kNoSettings,
"subtitle"))); "subtitle")));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -240,11 +240,11 @@ TEST_F(WebVttParserTest, ParseOneCueWithId) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample("id", 60000u, 3600000u, kNoSettings, OnProcess(IsTextSample(_, "id", 60000u, 3600000u, kNoSettings,
"subtitle"))); "subtitle")));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -262,11 +262,11 @@ TEST_F(WebVttParserTest, ParseOneCueWithSettings) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 60000u, 3600000u, "size:50%", OnProcess(IsTextSample(_, kNoId, 60000u, 3600000u, "size:50%",
"subtitle"))); "subtitle")));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -291,17 +291,17 @@ TEST_F(WebVttParserTest, ParseMultipleCues) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 1000u, 5200u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 1000u, 5200u, kNoSettings,
"subtitle A"))); "subtitle A")));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 2321u, 7000u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 2321u, 7000u, kNoSettings,
"subtitle B"))); "subtitle B")));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 5800u, 8000u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 5800u, 8000u, kNoSettings,
"subtitle C"))); "subtitle C")));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());
@ -337,17 +337,17 @@ TEST_F(WebVttParserTest, ParseWithComments) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsStreamInfo(kStreamIndex, kTimeScale, !kEncrypted))); OnProcess(IsStreamInfo(_, kTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 1000u, 5200u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 1000u, 5200u, kNoSettings,
"subtitle A"))); "subtitle A")));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 2321u, 7000u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 2321u, 7000u, kNoSettings,
"subtitle B"))); "subtitle B")));
EXPECT_CALL(*Output(kOutputIndex), EXPECT_CALL(*Output(kOutputIndex),
OnProcess(IsTextSample(kNoId, 5800u, 8000u, kNoSettings, OnProcess(IsTextSample(_, kNoId, 5800u, 8000u, kNoSettings,
"subtitle C"))); "subtitle C")));
EXPECT_CALL(*Output(kOutputIndex), OnFlush(kStreamIndex)); EXPECT_CALL(*Output(kOutputIndex), OnFlush(_));
} }
ASSERT_OK(parser_->Run()); ASSERT_OK(parser_->Run());

View File

@ -11,6 +11,7 @@
#include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h" #include "packager/media/formats/webvtt/webvtt_to_mp4_handler.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
using testing::_;
using testing::AllOf; using testing::AllOf;
using testing::Not; using testing::Not;
@ -122,7 +123,7 @@ TEST_F(WebVttToMp4HandlerTest, IngoresEmptyPayloadSamples) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Gap - The gap and sample should be combines into a new gap that spans // Gap - The gap and sample should be combines into a new gap that spans
// the while segment. // the while segment.
@ -170,7 +171,7 @@ TEST_F(WebVttToMp4HandlerTest, NonZeroStartTime) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Gap // Gap
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
@ -227,7 +228,7 @@ TEST_F(WebVttToMp4HandlerTest, NoOverlap) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
@ -300,7 +301,7 @@ TEST_F(WebVttToMp4HandlerTest, Overlap) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
@ -375,7 +376,7 @@ TEST_F(WebVttToMp4HandlerTest, Contains) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
@ -434,7 +435,7 @@ TEST_F(WebVttToMp4HandlerTest, ExactOverlap) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Both Samples // Both Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
@ -496,7 +497,7 @@ TEST_F(WebVttToMp4HandlerTest, OverlapStartWithStaggerEnd) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Three Samples // Three Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
@ -576,7 +577,7 @@ TEST_F(WebVttToMp4HandlerTest, StaggerStartWithOverlapEnd) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// One Sample // One Sample
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
@ -652,7 +653,7 @@ TEST_F(WebVttToMp4HandlerTest, CrossSegmentSamples) {
{ {
testing::InSequence s; testing::InSequence s;
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Gap, Sample, Segment // Gap, Sample, Segment
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),