OLD | NEW |
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" |
11 #include "media/base/mock_callback.h" | 11 #include "media/base/mock_callback.h" |
12 #include "media/base/mock_filter_host.h" | 12 #include "media/base/mock_demuxer_host.h" |
13 #include "media/base/mock_filters.h" | 13 #include "media/base/mock_filters.h" |
14 #include "media/base/mock_reader.h" | 14 #include "media/base/mock_reader.h" |
15 #include "media/ffmpeg/ffmpeg_common.h" | 15 #include "media/ffmpeg/ffmpeg_common.h" |
16 #include "media/filters/ffmpeg_demuxer.h" | 16 #include "media/filters/ffmpeg_demuxer.h" |
17 #include "media/filters/file_data_source.h" | 17 #include "media/filters/file_data_source.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using ::testing::AnyNumber; | 20 using ::testing::AnyNumber; |
21 using ::testing::DoAll; | 21 using ::testing::DoAll; |
22 using ::testing::InSequence; | 22 using ::testing::InSequence; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 bool VideoHasValidBitrate( | 121 bool VideoHasValidBitrate( |
122 const std::string& file_name, bool disable_file_size) { | 122 const std::string& file_name, bool disable_file_size) { |
123 scoped_refptr<FileDataSource> data_source = | 123 scoped_refptr<FileDataSource> data_source = |
124 CreateDataSource(file_name, disable_file_size); | 124 CreateDataSource(file_name, disable_file_size); |
125 InitializeDemuxer(data_source); | 125 InitializeDemuxer(data_source); |
126 return demuxer_->GetBitrate() > 0; | 126 return demuxer_->GetBitrate() > 0; |
127 } | 127 } |
128 | 128 |
129 // Fixture members. | 129 // Fixture members. |
130 scoped_refptr<FFmpegDemuxer> demuxer_; | 130 scoped_refptr<FFmpegDemuxer> demuxer_; |
131 StrictMock<MockFilterHost> host_; | 131 StrictMock<MockDemuxerHost> host_; |
132 MessageLoop message_loop_; | 132 MessageLoop message_loop_; |
133 | 133 |
134 int64 current_read_position_; | 134 int64 current_read_position_; |
135 | 135 |
136 private: | 136 private: |
137 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerTest); | 137 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerTest); |
138 }; | 138 }; |
139 | 139 |
140 TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) { | 140 TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) { |
141 // Simulate av_open_input_file() failing. | 141 // Simulate av_open_input_file() failing. |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 message_loop_.RunAllPending(); | 696 message_loop_.RunAllPending(); |
697 EXPECT_TRUE(reader->called()); | 697 EXPECT_TRUE(reader->called()); |
698 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000); | 698 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000); |
699 | 699 |
700 // Manually release the last reference to the buffer and verify it was freed. | 700 // Manually release the last reference to the buffer and verify it was freed. |
701 reader->Reset(); | 701 reader->Reset(); |
702 message_loop_.RunAllPending(); | 702 message_loop_.RunAllPending(); |
703 } | 703 } |
704 | 704 |
705 } // namespace media | 705 } // namespace media |
OLD | NEW |