Enable media event unit tests

Change-Id: Ie3d5418a875da8f7091430b0aa73e3817b162248
This commit is contained in:
Rintaro Kuroiwa 2014-02-18 19:14:47 -08:00
parent b93f2020c8
commit 4047cb78cc
1 changed files with 56 additions and 58 deletions

View File

@ -209,81 +209,79 @@ class VodMediaInfoDumpMuxerListenerTest : public ::testing::Test {
DISALLOW_COPY_AND_ASSIGN(VodMediaInfoDumpMuxerListenerTest); DISALLOW_COPY_AND_ASSIGN(VodMediaInfoDumpMuxerListenerTest);
}; };
// TODO(rkuroiwa): Enable these when implemented. TEST_F(VodMediaInfoDumpMuxerListenerTest, UnencryptedStream_Normal) {
TEST_F(VodMediaInfoDumpMuxerListenerTest, DISABLED_UnencryptedStream_Normal) { scoped_refptr<StreamInfo> stream_info =
VideoStreamInfoParameters params = GetDefaultVideoStreamInfoParams(); CreateVideoStreamInfo(GetDefaultVideoStreamInfoParams());
params.is_encrypted = false;
std::vector<StreamInfo*> stream_infos; std::vector<StreamInfo*> stream_infos;
scoped_refptr<StreamInfo> stream_info = CreateVideoStreamInfo(params);
stream_infos.push_back(stream_info.get()); stream_infos.push_back(stream_info.get());
FireOnMediaStartWithDefaultValues(stream_infos); FireOnMediaStartWithDefaultValues(stream_infos);
FireOnMediaEndWithParams(stream_infos, OnMediaEndParameters media_end_param = GetDefaultOnMediaEndParams();
GetDefaultOnMediaEndParams()); media_end_param.is_encrypted = false;
FireOnMediaEndWithParams(stream_infos, media_end_param);
ASSERT_TRUE(temp_file_->Close()); ASSERT_TRUE(temp_file_->Close());
const char* kExpectedProtobufOutput = "\ const char kExpectedProtobufOutput[] =
bandwidth: 7620\n\ "bandwidth: 7620\n"
video_info {\n\ "video_info {\n"
codec: \"avc1.010101\"\n\ " codec: \"avc1.010101\"\n"
width: 720\n\ " width: 720\n"
height: 480\n\ " height: 480\n"
time_scale: 10\n\ " time_scale: 10\n"
}\n\ "}\n"
init_range {\n\ "init_range {\n"
begin: 0\n\ " begin: 0\n"
end: 120\n\ " end: 120\n"
}\n\ "}\n"
index_range {\n\ "index_range {\n"
begin: 121\n\ " begin: 121\n"
end: 221\n\ " end: 221\n"
}\n\ "}\n"
reference_time_scale: 1000\n\ "reference_time_scale: 1000\n"
container_type: 1\n\ "container_type: 1\n"
media_file_name: \"test_output_file_name.mp4\"\n\ "media_file_name: \"test_output_file_name.mp4\"\n"
media_duration_seconds: 10.5\n"; "media_duration_seconds: 10.5\n";
ASSERT_NO_FATAL_FAILURE(ExpectTempFileToEqual(kExpectedProtobufOutput)); ASSERT_NO_FATAL_FAILURE(ExpectTempFileToEqual(kExpectedProtobufOutput));
} }
TEST_F(VodMediaInfoDumpMuxerListenerTest, DISABLED_EncryptedStream_Normal) { TEST_F(VodMediaInfoDumpMuxerListenerTest, EncryptedStream_Normal) {
listener_->SetContentProtectionSchemeIdUri("http://foo.com/bar"); listener_->SetContentProtectionSchemeIdUri("http://foo.com/bar");
VideoStreamInfoParameters params = GetDefaultVideoStreamInfoParams(); scoped_refptr<StreamInfo> stream_info =
params.is_encrypted = true; CreateVideoStreamInfo(GetDefaultVideoStreamInfoParams());
std::vector<StreamInfo*> stream_infos; std::vector<StreamInfo*> stream_infos;
scoped_refptr<StreamInfo> stream_info = CreateVideoStreamInfo(params);
stream_infos.push_back(stream_info.get()); stream_infos.push_back(stream_info.get());
FireOnMediaStartWithDefaultValues(stream_infos); FireOnMediaStartWithDefaultValues(stream_infos);
FireOnMediaEndWithParams(stream_infos,
GetDefaultOnMediaEndParams()); OnMediaEndParameters media_end_param = GetDefaultOnMediaEndParams();
media_end_param.is_encrypted = true;
FireOnMediaEndWithParams(stream_infos, media_end_param);
ASSERT_TRUE(temp_file_->Close()); ASSERT_TRUE(temp_file_->Close());
const char* kExpectedProtobufOutput = "\ const char kExpectedProtobufOutput[] =
bandwidth: 7620\n\ "bandwidth: 7620\n"
video_info {\n\ "video_info {\n"
codec: \"avc1.010101\"\n\ " codec: \"avc1.010101\"\n"
width: 720\n\ " width: 720\n"
height: 480\n\ " height: 480\n"
time_scale: 10\n\ " time_scale: 10\n"
}\n\ "}\n"
content_protections {\n\ "content_protections {\n"
scheme_id_uri: \"http://foo.com/bar\"\n\ " scheme_id_uri: \"http://foo.com/bar\"\n"
}\n\ "}\n"
init_range {\n\ "init_range {\n"
begin: 0\n\ " begin: 0\n"
end: 120\n\ " end: 120\n"
}\n\ "}\n"
index_range {\n\ "index_range {\n"
begin: 121\n\ " begin: 121\n"
end: 221\n\ " end: 221\n"
}\n\ "}\n"
reference_time_scale: 1000\n\ "reference_time_scale: 1000\n"
container_type: 1\n\ "container_type: 1\n"
media_file_name: \"test_output_file_name.mp4\"\n\ "media_file_name: \"test_output_file_name.mp4\"\n"
media_duration_seconds: 10.5\n"; "media_duration_seconds: 10.5\n";
ASSERT_NO_FATAL_FAILURE(ExpectTempFileToEqual(kExpectedProtobufOutput)); ASSERT_NO_FATAL_FAILURE(ExpectTempFileToEqual(kExpectedProtobufOutput));
} }