Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: media/formats/webm/webm_cluster_parser_unittest.cc

Issue 1316013002: MSE: Refine WebM parser unit test MediaLog verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_and_reland_mse_webm_parser_medialog_verifications
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/webm/webm_cluster_parser_unittest.cc
diff --git a/media/formats/webm/webm_cluster_parser_unittest.cc b/media/formats/webm/webm_cluster_parser_unittest.cc
index db3321a426f395f48e9927105ba72e7de738b3cd..b50840b30088b80adc8892e392d56587b3183c8c 100644
--- a/media/formats/webm/webm_cluster_parser_unittest.cc
+++ b/media/formats/webm/webm_cluster_parser_unittest.cc
@@ -24,6 +24,7 @@ using ::testing::HasSubstr;
using ::testing::InSequence;
using ::testing::Return;
using ::testing::StrictMock;
+using ::testing::Mock;
using ::testing::_;
namespace media {
@@ -1037,10 +1038,10 @@ TEST_F(WebMClusterParserTest,
}
TEST_F(WebMClusterParserTest, ReadOpusDurationsSimpleBlockAtEndOfCluster) {
- InSequence s;
-
int loop_count = 0;
for (const auto* packet_ptr : BuildAllOpusPackets()) {
+ InSequence s;
+
// Get a new parser each iteration to prevent exceeding the media log cap.
parser_.reset(CreateParserWithKeyIdsAndAudioCodec(
std::string(), std::string(), kCodecOpus));
@@ -1062,6 +1063,10 @@ TEST_F(WebMClusterParserTest, ReadOpusDurationsSimpleBlockAtEndOfCluster) {
int result = parser_->Parse(cluster->data(), cluster->size());
EXPECT_EQ(cluster->size(), result);
ASSERT_TRUE(VerifyBuffers(parser_, kBlockInfo, block_count));
+
+ // Fail early if any iteration fails to meet the logging expectations.
+ ASSERT_TRUE(Mock::VerifyAndClearExpectations(media_log_.get()));
+
loop_count++;
}
@@ -1070,12 +1075,10 @@ TEST_F(WebMClusterParserTest, ReadOpusDurationsSimpleBlockAtEndOfCluster) {
}
TEST_F(WebMClusterParserTest, PreferOpusDurationsOverBlockDurations) {
- // Exhaustively testing expected media logs' emission sequence in this test at
- // least causes 10x execution time. Therefore, no InSequence is used here, but
- // the set of expected messages is verified.
-
int loop_count = 0;
for (const auto* packet_ptr : BuildAllOpusPackets()) {
+ InSequence s;
+
// Get a new parser each iteration to prevent exceeding the media log cap.
parser_.reset(CreateParserWithKeyIdsAndAudioCodec(
std::string(), std::string(), kCodecOpus));
@@ -1106,6 +1109,10 @@ TEST_F(WebMClusterParserTest, PreferOpusDurationsOverBlockDurations) {
block_infos[0].duration = packet_ptr->duration_ms();
ASSERT_TRUE(VerifyBuffers(parser_, block_infos, block_count));
+
+ // Fail early if any iteration fails to meet the logging expectations.
+ ASSERT_TRUE(Mock::VerifyAndClearExpectations(media_log_.get()));
+
loop_count++;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698