| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "media/base/audio_decoder_config.h" | 9 #include "media/base/audio_decoder_config.h" |
| 10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 ChunkDemuxerTest() { | 146 ChunkDemuxerTest() { |
| 147 CreateNewDemuxer(); | 147 CreateNewDemuxer(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void CreateNewDemuxer() { | 150 void CreateNewDemuxer() { |
| 151 base::Closure open_cb = | 151 base::Closure open_cb = |
| 152 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); | 152 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); |
| 153 ChunkDemuxer::NeedKeyCB need_key_cb = | 153 ChunkDemuxer::NeedKeyCB need_key_cb = |
| 154 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); | 154 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); |
| 155 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, LogCB())); | 155 AddTextTrackCB add_text_track_cb = |
| 156 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this)); |
| 157 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, |
| 158 add_text_track_cb, LogCB())); |
| 156 } | 159 } |
| 157 | 160 |
| 158 virtual ~ChunkDemuxerTest() { | 161 virtual ~ChunkDemuxerTest() { |
| 159 ShutdownDemuxer(); | 162 ShutdownDemuxer(); |
| 160 } | 163 } |
| 161 | 164 |
| 162 void CreateInitSegment(bool has_audio, bool has_video, | 165 void CreateInitSegment(bool has_audio, bool has_video, |
| 163 bool is_audio_encrypted, bool is_video_encrypted, | 166 bool is_audio_encrypted, bool is_video_encrypted, |
| 164 scoped_ptr<uint8[]>* buffer, | 167 scoped_ptr<uint8[]>* buffer, |
| 165 int* size) { | 168 int* size) { |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 // are not supported in mocked methods. Remove this when the issue is fixed | 771 // are not supported in mocked methods. Remove this when the issue is fixed |
| 769 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use | 772 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use |
| 770 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). | 773 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). |
| 771 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, | 774 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, |
| 772 const uint8* init_data, int init_data_size)); | 775 const uint8* init_data, int init_data_size)); |
| 773 void DemuxerNeedKey(const std::string& type, | 776 void DemuxerNeedKey(const std::string& type, |
| 774 scoped_ptr<uint8[]> init_data, int init_data_size) { | 777 scoped_ptr<uint8[]> init_data, int init_data_size) { |
| 775 NeedKeyMock(type, init_data.get(), init_data_size); | 778 NeedKeyMock(type, init_data.get(), init_data_size); |
| 776 } | 779 } |
| 777 | 780 |
| 781 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, |
| 782 const std::string& label, |
| 783 const std::string& language) { |
| 784 return scoped_ptr<TextTrack>(); |
| 785 } |
| 786 |
| 778 base::MessageLoop message_loop_; | 787 base::MessageLoop message_loop_; |
| 779 MockDemuxerHost host_; | 788 MockDemuxerHost host_; |
| 780 | 789 |
| 781 scoped_ptr<ChunkDemuxer> demuxer_; | 790 scoped_ptr<ChunkDemuxer> demuxer_; |
| 782 | 791 |
| 783 private: | 792 private: |
| 784 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); | 793 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); |
| 785 }; | 794 }; |
| 786 | 795 |
| 787 TEST_F(ChunkDemuxerTest, TestInit) { | 796 TEST_F(ChunkDemuxerTest, TestInit) { |
| (...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2459 // Normally this would return an audio buffer at timestamp zero, but | 2468 // Normally this would return an audio buffer at timestamp zero, but |
| 2460 // all reads should return EOS buffers when disabled. | 2469 // all reads should return EOS buffers when disabled. |
| 2461 bool audio_read_done = false; | 2470 bool audio_read_done = false; |
| 2462 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done)); | 2471 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done)); |
| 2463 message_loop_.RunUntilIdle(); | 2472 message_loop_.RunUntilIdle(); |
| 2464 | 2473 |
| 2465 EXPECT_TRUE(audio_read_done); | 2474 EXPECT_TRUE(audio_read_done); |
| 2466 } | 2475 } |
| 2467 | 2476 |
| 2468 } // namespace media | 2477 } // namespace media |
| OLD | NEW |