| 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" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); | 490 EXPECT_CALL(*demuxer, SignalReadCompleted(512)); |
| 491 EXPECT_CALL(*demuxer, WaitForRead()) | 491 EXPECT_CALL(*demuxer, WaitForRead()) |
| 492 .WillOnce(Return(512)); | 492 .WillOnce(Return(512)); |
| 493 EXPECT_CALL(host_, SetCurrentReadPosition(1024)); | 493 EXPECT_CALL(host_, SetCurrentReadPosition(1024)); |
| 494 | 494 |
| 495 // Third read will fail because it exceeds the file size. | 495 // Third read will fail because it exceeds the file size. |
| 496 EXPECT_CALL(*data_source, GetSize(_)) | 496 EXPECT_CALL(*data_source, GetSize(_)) |
| 497 .WillOnce(DoAll(SetArgPointee<0>(1024), Return(true))); | 497 .WillOnce(DoAll(SetArgPointee<0>(1024), Return(true))); |
| 498 | 498 |
| 499 // First read. | 499 // First read. |
| 500 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); | 500 EXPECT_EQ(512u, demuxer->Read(512, kBuffer)); |
| 501 int64 position; | 501 int64 position; |
| 502 EXPECT_TRUE(demuxer->GetPosition(&position)); | 502 EXPECT_TRUE(demuxer->GetPosition(&position)); |
| 503 EXPECT_EQ(512, position); | 503 EXPECT_EQ(512, position); |
| 504 | 504 |
| 505 // Second read. | 505 // Second read. |
| 506 EXPECT_EQ(512, demuxer->Read(512, kBuffer)); | 506 EXPECT_EQ(512u, demuxer->Read(512, kBuffer)); |
| 507 EXPECT_TRUE(demuxer->GetPosition(&position)); | 507 EXPECT_TRUE(demuxer->GetPosition(&position)); |
| 508 EXPECT_EQ(1024, position); | 508 EXPECT_EQ(1024, position); |
| 509 | 509 |
| 510 // Third read will get an end-of-file error, which is represented as zero. | 510 // Third read will get an end-of-file error, which is represented as zero. |
| 511 EXPECT_EQ(0, demuxer->Read(512, kBuffer)); | 511 EXPECT_EQ(0u, demuxer->Read(512, kBuffer)); |
| 512 | 512 |
| 513 // This read complete signal is generated when demuxer is stopped. | 513 // This read complete signal is generated when demuxer is stopped. |
| 514 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); | 514 EXPECT_CALL(*demuxer, SignalReadCompleted(DataSource::kReadError)); |
| 515 demuxer->Stop(NewExpectedCallback()); | 515 demuxer->Stop(NewExpectedCallback()); |
| 516 message_loop_.RunAllPending(); | 516 message_loop_.RunAllPending(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 TEST_F(FFmpegDemuxerTest, GetBitrate_SetInContainer) { | 519 TEST_F(FFmpegDemuxerTest, GetBitrate_SetInContainer) { |
| 520 EXPECT_TRUE(VideoHasValidBitrate("bear.ogv", false)); | 520 EXPECT_TRUE(VideoHasValidBitrate("bear.ogv", false)); |
| 521 } | 521 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 566 |
| 567 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { | 567 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { |
| 568 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); | 568 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); |
| 569 InitializeDemuxer(data_source); | 569 InitializeDemuxer(data_source); |
| 570 | 570 |
| 571 EXPECT_FALSE(data_source->IsStreaming()); | 571 EXPECT_FALSE(data_source->IsStreaming()); |
| 572 EXPECT_FALSE(demuxer_->IsStreaming()); | 572 EXPECT_FALSE(demuxer_->IsStreaming()); |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace media | 575 } // namespace media |
| OLD | NEW |