| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/thread.h" | 8 #include "base/thread.h" |
| 9 #include "media/base/filters.h" | 9 #include "media/base/filters.h" |
| 10 #include "media/base/mock_ffmpeg.h" | 10 #include "media/base/mock_ffmpeg.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 uint8 kBuffer[1]; | 709 uint8 kBuffer[1]; |
| 710 InSequence s; | 710 InSequence s; |
| 711 // Actions taken in the first read. | 711 // Actions taken in the first read. |
| 712 EXPECT_CALL(*data_source_, GetSize(_)) | 712 EXPECT_CALL(*data_source_, GetSize(_)) |
| 713 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); | 713 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); |
| 714 EXPECT_CALL(*data_source_, Read(0, 512, kBuffer, NotNull())) | 714 EXPECT_CALL(*data_source_, Read(0, 512, kBuffer, NotNull())) |
| 715 .WillOnce(WithArgs<1, 3>(Invoke(&RunCallback))); | 715 .WillOnce(WithArgs<1, 3>(Invoke(&RunCallback))); |
| 716 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); | 716 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); |
| 717 EXPECT_CALL(*demuxer, WaitForRead()) | 717 EXPECT_CALL(*demuxer, WaitForRead()) |
| 718 .WillOnce(Return(512)); | 718 .WillOnce(Return(512)); |
| 719 EXPECT_CALL(host_, SetCurrentReadPosition(512)); |
| 719 | 720 |
| 720 // Second read. | 721 // Second read. |
| 721 EXPECT_CALL(*data_source_, GetSize(_)) | 722 EXPECT_CALL(*data_source_, GetSize(_)) |
| 722 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); | 723 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); |
| 723 EXPECT_CALL(*data_source_, Read(512, 512, kBuffer, NotNull())) | 724 EXPECT_CALL(*data_source_, Read(512, 512, kBuffer, NotNull())) |
| 724 .WillOnce(WithArgs<1, 3>(Invoke(&RunCallback))); | 725 .WillOnce(WithArgs<1, 3>(Invoke(&RunCallback))); |
| 725 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); | 726 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); |
| 726 EXPECT_CALL(*demuxer, WaitForRead()) | 727 EXPECT_CALL(*demuxer, WaitForRead()) |
| 727 .WillOnce(Return(512)); | 728 .WillOnce(Return(512)); |
| 729 EXPECT_CALL(host_, SetCurrentReadPosition(1024)); |
| 728 | 730 |
| 729 // Third read will fail because it exceeds the file size. | 731 // Third read will fail because it exceeds the file size. |
| 730 EXPECT_CALL(*data_source_, GetSize(_)) | 732 EXPECT_CALL(*data_source_, GetSize(_)) |
| 731 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); | 733 .WillOnce(DoAll(SetArgumentPointee<0>(1024), Return(true))); |
| 732 | 734 |
| 733 // This read complete signal is generated when demuxer is stopped. | 735 // This read complete signal is generated when demuxer is stopped. |
| 734 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); | 736 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); |
| 735 | 737 |
| 736 // First read. | 738 // First read. |
| 737 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); | 739 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 { | 796 { |
| 795 SCOPED_TRACE(""); | 797 SCOPED_TRACE(""); |
| 796 InitializeDemuxer(); | 798 InitializeDemuxer(); |
| 797 } | 799 } |
| 798 EXPECT_CALL(*data_source_, IsStreaming()) | 800 EXPECT_CALL(*data_source_, IsStreaming()) |
| 799 .WillOnce(Return(false)); | 801 .WillOnce(Return(false)); |
| 800 EXPECT_FALSE(demuxer_->IsStreaming()); | 802 EXPECT_FALSE(demuxer_->IsStreaming()); |
| 801 } | 803 } |
| 802 | 804 |
| 803 } // namespace media | 805 } // namespace media |
| OLD | NEW |