| 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/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "media/base/filters.h" | 8 #include "media/base/filters.h" |
| 9 #include "media/base/mock_callback.h" | 9 #include "media/base/mock_callback.h" |
| 10 #include "media/base/mock_ffmpeg.h" | 10 #include "media/base/mock_ffmpeg.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); | 675 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); |
| 676 int64 position; | 676 int64 position; |
| 677 EXPECT_TRUE(demuxer->GetPosition(&position)); | 677 EXPECT_TRUE(demuxer->GetPosition(&position)); |
| 678 EXPECT_EQ(512, position); | 678 EXPECT_EQ(512, position); |
| 679 | 679 |
| 680 // Second read. | 680 // Second read. |
| 681 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); | 681 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); |
| 682 EXPECT_TRUE(demuxer->GetPosition(&position)); | 682 EXPECT_TRUE(demuxer->GetPosition(&position)); |
| 683 EXPECT_EQ(1024, position); | 683 EXPECT_EQ(1024, position); |
| 684 | 684 |
| 685 // Third read will get an end-of-file error. | 685 // Third read will get an end-of-file error, which is represented as zero. |
| 686 EXPECT_EQ(AVERROR_EOF, demuxer->Read(512, kBuffer)); | 686 EXPECT_EQ(0, demuxer->Read(512, kBuffer)); |
| 687 | 687 |
| 688 // This read complete signal is generated when demuxer is stopped. | 688 // This read complete signal is generated when demuxer is stopped. |
| 689 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); | 689 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); |
| 690 demuxer->Stop(NewExpectedCallback()); | 690 demuxer->Stop(NewExpectedCallback()); |
| 691 message_loop_.RunAllPending(); | 691 message_loop_.RunAllPending(); |
| 692 } | 692 } |
| 693 | 693 |
| 694 TEST_F(FFmpegDemuxerTest, ProtocolGetSetPosition) { | 694 TEST_F(FFmpegDemuxerTest, ProtocolGetSetPosition) { |
| 695 { | 695 { |
| 696 SCOPED_TRACE(""); | 696 SCOPED_TRACE(""); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 { | 735 { |
| 736 SCOPED_TRACE(""); | 736 SCOPED_TRACE(""); |
| 737 InitializeDemuxer(); | 737 InitializeDemuxer(); |
| 738 } | 738 } |
| 739 EXPECT_CALL(*data_source_, IsStreaming()) | 739 EXPECT_CALL(*data_source_, IsStreaming()) |
| 740 .WillOnce(Return(false)); | 740 .WillOnce(Return(false)); |
| 741 EXPECT_FALSE(demuxer_->IsStreaming()); | 741 EXPECT_FALSE(demuxer_->IsStreaming()); |
| 742 } | 742 } |
| 743 | 743 |
| 744 } // namespace media | 744 } // namespace media |
| OLD | NEW |