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

Unified Diff: media/capture/webm_muxer_unittest.cc

Issue 1313603004: MediaRecorderHandler (video part) and unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, gyp and MediaRecorderHandlerTest 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
« media/capture/webm_muxer.cc ('K') | « 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 e3fd4d4f0fa0e603eb848ba0b55ab1b9f398c3b2..57f719ae6adce4e5824decd651ecb6a66982e04b 100644
--- a/media/capture/webm_muxer_unittest.cc
+++ b/media/capture/webm_muxer_unittest.cc
@@ -35,7 +35,6 @@ class WebmMuxerTest : public testing::Test, public EventHandlerInterface {
accumulated_position_(0) {
EXPECT_EQ(webm_muxer_.Position(), 0);
EXPECT_FALSE(webm_muxer_.Seekable());
- EXPECT_EQ(webm_muxer_.segment_.mode(), mkvmuxer::Segment::kLive);
}
MOCK_METHOD1(WriteCallback, void(const base::StringPiece&));
@@ -49,6 +48,14 @@ class WebmMuxerTest : public testing::Test, public EventHandlerInterface {
return webm_muxer_.Position();
}
+ mkvmuxer::int32 SetWebmMuxerPosition(mkvmuxer::int64 position) {
+ return webm_muxer_.Position(position);
+ }
+
+ mkvmuxer::Segment::Mode GetWebmSegmentMode() const {
+ return webm_muxer_.segment_.mode();
+ }
+
mkvmuxer::int32 WebmMuxerWrite(const void* buf, mkvmuxer::uint32 len) {
return webm_muxer_.Write(buf, len);
}
@@ -65,8 +72,11 @@ class WebmMuxerTest : public testing::Test, public EventHandlerInterface {
// Checks that the WriteCallback is called with appropriate params when
// WebmMuxer::Write() method is called.
TEST_F(WebmMuxerTest, Write) {
- const base::StringPiece encoded_data("abcdefghijklmnopqrstuvwxyz");
+ // A live WebM muxer does not accept setting the position.
+ const mkvmuxer::int64 kRandomNewPosition = 333;
+ EXPECT_EQ(SetWebmMuxerPosition(kRandomNewPosition), -1);
+ const base::StringPiece encoded_data("abcdefghijklmnopqrstuvwxyz");
EXPECT_CALL(*this, WriteCallback(encoded_data));
WebmMuxerWrite(encoded_data.data(), encoded_data.size());
@@ -95,6 +105,7 @@ TEST_F(WebmMuxerTest, OnEncodedVideoTwoFrames) {
EXPECT_EQ(last_encoded_length_, encoded_data.size());
EXPECT_EQ(GetWebmMuxerPosition(), accumulated_position_);
EXPECT_GE(GetWebmMuxerPosition(), static_cast<int64_t>(last_encoded_length_));
+ EXPECT_EQ(GetWebmSegmentMode(), mkvmuxer::Segment::kLive);
const int64_t begin_of_second_block = accumulated_position_;
EXPECT_CALL(*this, WriteCallback(_))
« media/capture/webm_muxer.cc ('K') | « media/capture/webm_muxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698