OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 reader->Reset(); | 422 reader->Reset(); |
423 message_loop_.RunAllPending(); | 423 message_loop_.RunAllPending(); |
424 } | 424 } |
425 | 425 |
426 // A mocked callback specialization for calling Read(). Since RunWithParams() | 426 // A mocked callback specialization for calling Read(). Since RunWithParams() |
427 // is mocked we don't need to pass in object or method pointers. | 427 // is mocked we don't need to pass in object or method pointers. |
428 class MockReadCB : public base::RefCountedThreadSafe<MockReadCB> { | 428 class MockReadCB : public base::RefCountedThreadSafe<MockReadCB> { |
429 public: | 429 public: |
430 MockReadCB() {} | 430 MockReadCB() {} |
431 | 431 |
| 432 MOCK_METHOD0(OnDelete, void()); |
| 433 MOCK_METHOD1(Run, void(const scoped_refptr<Buffer>& buffer)); |
| 434 |
| 435 protected: |
432 virtual ~MockReadCB() { | 436 virtual ~MockReadCB() { |
433 OnDelete(); | 437 OnDelete(); |
434 } | 438 } |
435 | 439 |
436 MOCK_METHOD0(OnDelete, void()); | 440 private: |
437 MOCK_METHOD1(Run, void(const scoped_refptr<Buffer>& buffer)); | 441 friend class base::RefCountedThreadSafe<MockReadCB>; |
438 | 442 |
439 private: | |
440 DISALLOW_COPY_AND_ASSIGN(MockReadCB); | 443 DISALLOW_COPY_AND_ASSIGN(MockReadCB); |
441 }; | 444 }; |
442 | 445 |
443 TEST_F(FFmpegDemuxerTest, Stop) { | 446 TEST_F(FFmpegDemuxerTest, Stop) { |
444 // Tests that calling Read() on a stopped demuxer stream immediately deletes | 447 // Tests that calling Read() on a stopped demuxer stream immediately deletes |
445 // the callback. | 448 // the callback. |
446 CreateDemuxer("bear-320x240.webm"); | 449 CreateDemuxer("bear-320x240.webm"); |
447 InitializeDemuxer(); | 450 InitializeDemuxer(); |
448 | 451 |
449 // Get our stream. | 452 // Get our stream. |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { | 767 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { |
765 CreateDemuxer("vorbis_audio_wmv_video.mkv"); | 768 CreateDemuxer("vorbis_audio_wmv_video.mkv"); |
766 InitializeDemuxer(); | 769 InitializeDemuxer(); |
767 | 770 |
768 // Ensure the expected streams are present. | 771 // Ensure the expected streams are present. |
769 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 772 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
770 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 773 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
771 } | 774 } |
772 | 775 |
773 } // namespace media | 776 } // namespace media |
OLD | NEW |