Commit d59f7acb authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Commit Bot

MSE: Use a MATCHER instead of duplicated string in WebMStreamParserTests

Following comments on review
https://chromium-review.googlesource.com/c/chromium/src/+/1065131 this CL
refactors a set of duplicated expectations to instead use a common, new,
MATCHER.

BUG=840751

Change-Id: Ie2f0e9080478fab37d2c632f9c5d26244dbabd29
Reviewed-on: https://chromium-review.googlesource.com/1067739Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560693}
parent 9dfac85d
......@@ -331,6 +331,12 @@ MATCHER_P2(SkippingSpliceTooLittleOverlap,
"result in loss of A/V sync.");
}
// Prefer WebMSimpleBlockDurationEstimated over this matcher, unless the actual
// estimated duration value is unimportant to the test.
MATCHER(WebMSimpleBlockDurationEstimatedAny, "") {
return CONTAINS_STRING(arg, "Estimating WebM block duration=");
}
MATCHER_P(WebMSimpleBlockDurationEstimated, estimated_duration_ms, "") {
return CONTAINS_STRING(arg, "Estimating WebM block duration=" +
base::IntToString(estimated_duration_ms));
......
......@@ -13,6 +13,7 @@
#include "media/base/mock_media_log.h"
#include "media/base/stream_parser.h"
#include "media/base/test_data_util.h"
#include "media/base/test_helpers.h"
#include "media/base/text_track_config.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -91,7 +92,7 @@ class WebMStreamParserTest : public testing::Test {
};
TEST_F(WebMStreamParserTest, VerifyMediaTrackMetadata) {
EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimatedAny())
.Times(testing::AnyNumber());
StreamParser::InitParameters params(kInfiniteDuration);
params.detected_audio_track_count = 1;
......@@ -118,7 +119,7 @@ TEST_F(WebMStreamParserTest, VerifyMediaTrackMetadata) {
}
TEST_F(WebMStreamParserTest, VerifyDetectedTrack_AudioOnly) {
EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimatedAny())
.Times(testing::AnyNumber());
StreamParser::InitParameters params(kInfiniteDuration);
params.detected_audio_track_count = 1;
......@@ -140,7 +141,7 @@ TEST_F(WebMStreamParserTest, VerifyDetectedTrack_VideoOnly) {
}
TEST_F(WebMStreamParserTest, VerifyDetectedTracks_AVText) {
EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimatedAny())
.Times(testing::AnyNumber());
StreamParser::InitParameters params(kInfiniteDuration);
params.detected_audio_track_count = 1;
......@@ -153,7 +154,7 @@ TEST_F(WebMStreamParserTest, VerifyDetectedTracks_AVText) {
}
TEST_F(WebMStreamParserTest, ColourElement) {
EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimatedAny())
.Times(testing::AnyNumber());
StreamParser::InitParameters params(kInfiniteDuration);
params.detected_audio_track_count = 0;
......@@ -193,7 +194,7 @@ TEST_F(WebMStreamParserTest, ColourElement) {
}
TEST_F(WebMStreamParserTest, ColourElementWithUnspecifiedRange) {
EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimatedAny())
.Times(testing::AnyNumber());
StreamParser::InitParameters params(kInfiniteDuration);
params.detected_audio_track_count = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment