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

Unified Diff: media/capture/webm_muxer_unittest.cc

Issue 1233033002: MediaStream: Adding VideoTrackRecorder class and unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@s comment on OnFirstFrameCB and OnEncodedVideoCB 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
Index: media/capture/webm_muxer_unittest.cc
diff --git a/media/capture/webm_muxer_unittest.cc b/media/capture/webm_muxer_unittest.cc
index 6ae525c4ffd1c0b79e431371ab499ac7b800bbe7..d6ae278e3031f082439e421934bdd674094d69f2 100644
--- a/media/capture/webm_muxer_unittest.cc
+++ b/media/capture/webm_muxer_unittest.cc
@@ -48,10 +48,6 @@ class WebmMuxerTest : public testing::Test, public EventHandlerInterface {
return webm_muxer_.Position();
}
- const mkvmuxer::Segment& GetWebmMuxerSegment() const {
- return webm_muxer_.segment_;
- }
-
mkvmuxer::int32 WebmMuxerWrite(const void* buf, mkvmuxer::uint32 len) {
return webm_muxer_.Write(buf, len);
}
@@ -65,13 +61,6 @@ class WebmMuxerTest : public testing::Test, public EventHandlerInterface {
DISALLOW_COPY_AND_ASSIGN(WebmMuxerTest);
};
-// Checks that AddVideoTrack adds a Track.
-TEST_F(WebmMuxerTest, AddVideoTrack) {
- const uint64_t track_number = webm_muxer_.AddVideoTrack(gfx::Size(320, 240),
- 30.0f);
- EXPECT_TRUE(GetWebmMuxerSegment().GetTrackByNumber(track_number));
-}
-
// Checks that the WriteCallback is called with appropriate params when
// WebmMuxer::Write() method is called.
TEST_F(WebmMuxerTest, Write) {
@@ -85,19 +74,19 @@ TEST_F(WebmMuxerTest, Write) {
// This test sends two frames and checks that the WriteCallback is called with
// appropriate params in both cases.
-TEST_F(WebmMuxerTest, OnEncodedVideoNormalFrames) {
+TEST_F(WebmMuxerTest, OnEncodedVideoTwoFrames) {
const base::StringPiece encoded_data("abcdefghijklmnopqrstuvwxyz");
- const uint64_t track_number = webm_muxer_.AddVideoTrack(gfx::Size(320, 240),
- 30.0f);
+ const WebmMuxer::OnEncodedVideoCB on_encoded_video_callback =
+ webm_muxer_.AddVideoTrack(gfx::Size(320, 240), 30.0f);
+ EXPECT_FALSE(on_encoded_video_callback.is_null());
EXPECT_CALL(*this, WriteCallback(_))
.Times(AtLeast(1))
.WillRepeatedly(WithArgs<0>(
Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- webm_muxer_.OnEncodedVideo(track_number,
- encoded_data,
- base::TimeDelta::FromMicroseconds(0),
- false /* keyframe */);
+ on_encoded_video_callback.Run(encoded_data,
+ base::TimeDelta::FromMicroseconds(0),
+ false /* keyframe */);
// First time around WriteCallback() is pinged a number of times to write the
// Matroska header, but at the end it dumps |encoded_data|.
@@ -110,10 +99,9 @@ TEST_F(WebmMuxerTest, OnEncodedVideoNormalFrames) {
.Times(AtLeast(1))
.WillRepeatedly(WithArgs<0>(
Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- webm_muxer_.OnEncodedVideo(track_number,
- encoded_data,
- base::TimeDelta::FromMicroseconds(1),
- false /* keyframe */);
+ on_encoded_video_callback.Run(encoded_data,
+ base::TimeDelta::FromMicroseconds(1),
+ false /* keyframe */);
// The second time around the callbacks should include a SimpleBlock header,
// namely the track index, a timestamp and a flags byte, for a total of 6B.
« content/renderer/media/video_track_recorder.h ('K') | « media/capture/webm_muxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698