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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 2050043002: Generate and assign media track ids in demuxers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-streamparser-trackid
Patch Set: rebase to ToT Created 4 years, 6 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 | « media/formats/mp4/mp4_stream_parser.cc ('k') | media/test/pipeline_integration_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index f3830b8f3da75e502f2a2cd5a07fb0b6ddde5383..c18f5b0a7dc64681138d1757a6f41017cd0c57ac 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -632,7 +632,7 @@ class MockMediaSource {
CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk);
chunk_demuxer_->SetTracksWatcher(
- kSourceId, base::Bind(&MockMediaSource::InitSegmentReceivedWrapper,
+ kSourceId, base::Bind(&MockMediaSource::InitSegmentReceived,
base::Unretained(this)));
AppendData(initial_append_size_);
@@ -649,12 +649,20 @@ class MockMediaSource {
return last_timestamp_offset_;
}
- // A workaround for gtest mocks not allowing moving scoped_ptrs.
- void InitSegmentReceivedWrapper(std::unique_ptr<MediaTracks> tracks) {
- InitSegmentReceived(tracks);
+ void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks) {
+ CHECK(tracks.get());
+ EXPECT_GT(tracks->tracks().size(), 0u);
+ CHECK(chunk_demuxer_);
+ // Verify that track ids are unique.
+ std::set<MediaTrack::Id> track_ids;
+ for (const auto& track : tracks->tracks()) {
+ EXPECT_EQ(track_ids.end(), track_ids.find(track->id()));
+ track_ids.insert(track->id());
+ }
+ InitSegmentReceivedMock(tracks);
}
- MOCK_METHOD1(InitSegmentReceived, void(std::unique_ptr<MediaTracks>&));
+ MOCK_METHOD1(InitSegmentReceivedMock, void(std::unique_ptr<MediaTracks>&));
private:
scoped_refptr<DecoderBuffer> file_data_;
@@ -722,7 +730,7 @@ class PipelineIntegrationTest : public PipelineIntegrationTestHost {
hashing_enabled_ = test_type & kHashed;
clockless_playback_ = test_type & kClockless;
- EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1));
+ EXPECT_CALL(*source, InitSegmentReceivedMock(_)).Times(AtLeast(1));
EXPECT_CALL(*this, OnMetadata(_))
.Times(AtMost(1))
.WillRepeatedly(SaveArg<0>(&metadata_));
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.cc ('k') | media/test/pipeline_integration_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698