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

Side by Side Diff: media/formats/webm/webm_stream_parser_unittest.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/webm/webm_stream_parser.h" 5 #include "media/formats/webm/webm_stream_parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 MOCK_METHOD0(EndMediaSegmentCB, void()); 90 MOCK_METHOD0(EndMediaSegmentCB, void());
91 91
92 scoped_refptr<testing::StrictMock<MockMediaLog>> media_log_; 92 scoped_refptr<testing::StrictMock<MockMediaLog>> media_log_;
93 std::unique_ptr<WebMStreamParser> parser_; 93 std::unique_ptr<WebMStreamParser> parser_;
94 std::unique_ptr<MediaTracks> media_tracks_; 94 std::unique_ptr<MediaTracks> media_tracks_;
95 }; 95 };
96 96
97 TEST_F(WebMStreamParserTest, VerifyMediaTrackMetadata) { 97 TEST_F(WebMStreamParserTest, VerifyMediaTrackMetadata) {
98 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration")) 98 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
99 .Times(testing::AnyNumber()); 99 .Times(testing::AnyNumber());
100 StreamParser::InitParameters params(kInfiniteDuration()); 100 StreamParser::InitParameters params(kInfiniteDuration);
101 params.detected_audio_track_count = 1; 101 params.detected_audio_track_count = 1;
102 params.detected_video_track_count = 1; 102 params.detected_video_track_count = 1;
103 params.detected_text_track_count = 0; 103 params.detected_text_track_count = 0;
104 ParseWebMFile("bear.webm", params); 104 ParseWebMFile("bear.webm", params);
105 EXPECT_NE(media_tracks_.get(), nullptr); 105 EXPECT_NE(media_tracks_.get(), nullptr);
106 106
107 EXPECT_EQ(media_tracks_->tracks().size(), 2u); 107 EXPECT_EQ(media_tracks_->tracks().size(), 2u);
108 108
109 const MediaTrack& video_track = *(media_tracks_->tracks()[0]); 109 const MediaTrack& video_track = *(media_tracks_->tracks()[0]);
110 EXPECT_EQ(video_track.type(), MediaTrack::Video); 110 EXPECT_EQ(video_track.type(), MediaTrack::Video);
111 EXPECT_EQ(video_track.bytestream_track_id(), 1); 111 EXPECT_EQ(video_track.bytestream_track_id(), 1);
112 EXPECT_EQ(video_track.kind(), "main"); 112 EXPECT_EQ(video_track.kind(), "main");
113 EXPECT_EQ(video_track.label(), ""); 113 EXPECT_EQ(video_track.label(), "");
114 EXPECT_EQ(video_track.language(), "und"); 114 EXPECT_EQ(video_track.language(), "und");
115 115
116 const MediaTrack& audio_track = *(media_tracks_->tracks()[1]); 116 const MediaTrack& audio_track = *(media_tracks_->tracks()[1]);
117 EXPECT_EQ(audio_track.type(), MediaTrack::Audio); 117 EXPECT_EQ(audio_track.type(), MediaTrack::Audio);
118 EXPECT_EQ(audio_track.bytestream_track_id(), 2); 118 EXPECT_EQ(audio_track.bytestream_track_id(), 2);
119 EXPECT_EQ(audio_track.kind(), "main"); 119 EXPECT_EQ(audio_track.kind(), "main");
120 EXPECT_EQ(audio_track.label(), ""); 120 EXPECT_EQ(audio_track.label(), "");
121 EXPECT_EQ(audio_track.language(), "und"); 121 EXPECT_EQ(audio_track.language(), "und");
122 } 122 }
123 123
124 TEST_F(WebMStreamParserTest, VerifyDetectedTrack_AudioOnly) { 124 TEST_F(WebMStreamParserTest, VerifyDetectedTrack_AudioOnly) {
125 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration")) 125 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
126 .Times(testing::AnyNumber()); 126 .Times(testing::AnyNumber());
127 StreamParser::InitParameters params(kInfiniteDuration()); 127 StreamParser::InitParameters params(kInfiniteDuration);
128 params.detected_audio_track_count = 1; 128 params.detected_audio_track_count = 1;
129 params.detected_video_track_count = 0; 129 params.detected_video_track_count = 0;
130 params.detected_text_track_count = 0; 130 params.detected_text_track_count = 0;
131 ParseWebMFile("bear-320x240-audio-only.webm", params); 131 ParseWebMFile("bear-320x240-audio-only.webm", params);
132 EXPECT_EQ(media_tracks_->tracks().size(), 1u); 132 EXPECT_EQ(media_tracks_->tracks().size(), 1u);
133 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Audio); 133 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Audio);
134 } 134 }
135 135
136 TEST_F(WebMStreamParserTest, VerifyDetectedTrack_VideoOnly) { 136 TEST_F(WebMStreamParserTest, VerifyDetectedTrack_VideoOnly) {
137 StreamParser::InitParameters params(kInfiniteDuration()); 137 StreamParser::InitParameters params(kInfiniteDuration);
138 params.detected_audio_track_count = 0; 138 params.detected_audio_track_count = 0;
139 params.detected_video_track_count = 1; 139 params.detected_video_track_count = 1;
140 params.detected_text_track_count = 0; 140 params.detected_text_track_count = 0;
141 ParseWebMFile("bear-320x240-video-only.webm", params); 141 ParseWebMFile("bear-320x240-video-only.webm", params);
142 EXPECT_EQ(media_tracks_->tracks().size(), 1u); 142 EXPECT_EQ(media_tracks_->tracks().size(), 1u);
143 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video); 143 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video);
144 } 144 }
145 145
146 TEST_F(WebMStreamParserTest, VerifyDetectedTracks_AVText) { 146 TEST_F(WebMStreamParserTest, VerifyDetectedTracks_AVText) {
147 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration")) 147 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
148 .Times(testing::AnyNumber()); 148 .Times(testing::AnyNumber());
149 StreamParser::InitParameters params(kInfiniteDuration()); 149 StreamParser::InitParameters params(kInfiniteDuration);
150 params.detected_audio_track_count = 1; 150 params.detected_audio_track_count = 1;
151 params.detected_video_track_count = 1; 151 params.detected_video_track_count = 1;
152 params.detected_text_track_count = 1; 152 params.detected_text_track_count = 1;
153 ParseWebMFile("bear-vp8-webvtt.webm", params); 153 ParseWebMFile("bear-vp8-webvtt.webm", params);
154 EXPECT_EQ(media_tracks_->tracks().size(), 2u); 154 EXPECT_EQ(media_tracks_->tracks().size(), 2u);
155 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video); 155 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video);
156 EXPECT_EQ(media_tracks_->tracks()[1]->type(), MediaTrack::Audio); 156 EXPECT_EQ(media_tracks_->tracks()[1]->type(), MediaTrack::Audio);
157 } 157 }
158 158
159 } // namespace media 159 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698