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

Side by Side Diff: media/filters/ffmpeg_demuxer_unittest.cc

Issue 9317096: Fix media code to work with new ffmpeg. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes. Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <deque> 5 #include <deque>
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "media/base/filters.h" 10 #include "media/base/filters.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 StrictMock<MockDemuxerHost> host_; 137 StrictMock<MockDemuxerHost> host_;
138 MessageLoop message_loop_; 138 MessageLoop message_loop_;
139 139
140 int64 current_read_position_; 140 int64 current_read_position_;
141 141
142 private: 142 private:
143 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerTest); 143 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerTest);
144 }; 144 };
145 145
146 TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) { 146 TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) {
147 // Simulate av_open_input_file() failing. 147 // Simulate avformat_open_input() failing.
148 EXPECT_CALL(host_, SetCurrentReadPosition(_)); 148 EXPECT_CALL(host_, SetCurrentReadPosition(_));
149 demuxer_->Initialize(CreateDataSource("ten_byte_file"), 149 demuxer_->Initialize(CreateDataSource("ten_byte_file"),
150 NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN)); 150 NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN));
151 151
152 message_loop_.RunAllPending(); 152 message_loop_.RunAllPending();
153 } 153 }
154 154
155 // TODO(acolwell): Uncomment this test when we discover a file that passes 155 // TODO(acolwell): Uncomment this test when we discover a file that passes
156 // av_open_input_file(), but has av_find_stream_info() fail. 156 // avformat_open_input(), but has avformat_find_stream_info() fail.
157 // 157 //
158 //TEST_F(FFmpegDemuxerTest, Initialize_ParseFails) { 158 //TEST_F(FFmpegDemuxerTest, Initialize_ParseFails) {
159 // demuxer_->Initialize( 159 // demuxer_->Initialize(
160 // CreateDataSource("find_stream_info_fail.webm"), 160 // CreateDataSource("find_stream_info_fail.webm"),
161 // NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_PARSE)); 161 // NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_PARSE));
162 // message_loop_.RunAllPending(); 162 // message_loop_.RunAllPending();
163 //} 163 //}
164 164
165 TEST_F(FFmpegDemuxerTest, Initialize_NoStreams) { 165 TEST_F(FFmpegDemuxerTest, Initialize_NoStreams) {
166 // Open a file with no streams whatsoever. 166 // Open a file with no streams whatsoever.
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 TEST_F(FFmpegDemuxerTest, GetBitrate_UnsetInContainer_KnownSize) { 633 TEST_F(FFmpegDemuxerTest, GetBitrate_UnsetInContainer_KnownSize) {
634 EXPECT_TRUE(VideoHasValidBitrate("bear-320x240.webm", false)); 634 EXPECT_TRUE(VideoHasValidBitrate("bear-320x240.webm", false));
635 } 635 }
636 636
637 TEST_F(FFmpegDemuxerTest, GetBitrate_SetInContainer_NoFileSize) { 637 TEST_F(FFmpegDemuxerTest, GetBitrate_SetInContainer_NoFileSize) {
638 EXPECT_TRUE(VideoHasValidBitrate("bear.ogv", true)); 638 EXPECT_TRUE(VideoHasValidBitrate("bear.ogv", true));
639 } 639 }
640 640
641 TEST_F(FFmpegDemuxerTest, GetBitrate_UnsetInContainer_NoFileSize) { 641 TEST_F(FFmpegDemuxerTest, GetBitrate_UnsetInContainer_NoFileSize) {
642 EXPECT_FALSE(VideoHasValidBitrate("bear-320x240.webm", true)); 642 EXPECT_TRUE(VideoHasValidBitrate("bear-320x240.webm", true));
643 } 643 }
644 644
645 TEST_F(FFmpegDemuxerTest, ProtocolGetSetPosition) { 645 TEST_F(FFmpegDemuxerTest, ProtocolGetSetPosition) {
646 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); 646 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm");
647 InitializeDemuxer(data_source); 647 InitializeDemuxer(data_source);
648 648
649 InSequence s; 649 InSequence s;
650 650
651 int64 size; 651 int64 size;
652 int64 position; 652 int64 position;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 message_loop_.RunAllPending(); 737 message_loop_.RunAllPending();
738 EXPECT_TRUE(reader->called()); 738 EXPECT_TRUE(reader->called());
739 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000); 739 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000);
740 740
741 // Manually release the last reference to the buffer and verify it was freed. 741 // Manually release the last reference to the buffer and verify it was freed.
742 reader->Reset(); 742 reader->Reset();
743 message_loop_.RunAllPending(); 743 message_loop_.RunAllPending();
744 } 744 }
745 745
746 } // namespace media 746 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698