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

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: dalecurtis@ comments 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 | « media/capture/webm_muxer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e3fd4d4f0fa0e603eb848ba0b55ab1b9f398c3b2 100644
--- a/media/capture/webm_muxer_unittest.cc
+++ b/media/capture/webm_muxer_unittest.cc
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "media/base/video_frame.h"
#include "media/capture/webm_muxer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -48,10 +49,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 +62,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,18 +75,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 gfx::Size frame_size(160, 80);
+ const scoped_refptr<VideoFrame> video_frame =
+ VideoFrame::CreateBlackFrame(frame_size);
const base::StringPiece encoded_data("abcdefghijklmnopqrstuvwxyz");
- const uint64_t track_number = webm_muxer_.AddVideoTrack(gfx::Size(320, 240),
- 30.0f);
EXPECT_CALL(*this, WriteCallback(_))
.Times(AtLeast(1))
.WillRepeatedly(WithArgs<0>(
Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- webm_muxer_.OnEncodedVideo(track_number,
+ webm_muxer_.OnEncodedVideo(video_frame,
encoded_data,
- base::TimeDelta::FromMicroseconds(0),
+ base::TimeTicks::Now(),
false /* keyframe */);
// First time around WriteCallback() is pinged a number of times to write the
@@ -110,9 +101,9 @@ TEST_F(WebmMuxerTest, OnEncodedVideoNormalFrames) {
.Times(AtLeast(1))
.WillRepeatedly(WithArgs<0>(
Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- webm_muxer_.OnEncodedVideo(track_number,
+ webm_muxer_.OnEncodedVideo(video_frame,
encoded_data,
- base::TimeDelta::FromMicroseconds(1),
+ base::TimeTicks::Now(),
false /* keyframe */);
// The second time around the callbacks should include a SimpleBlock header,
« no previous file with comments | « media/capture/webm_muxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698