| 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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 ChunkDemuxerTest() { | 153 ChunkDemuxerTest() { |
| 154 CreateNewDemuxer(); | 154 CreateNewDemuxer(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void CreateNewDemuxer() { | 157 void CreateNewDemuxer() { |
| 158 base::Closure open_cb = | 158 base::Closure open_cb = |
| 159 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); | 159 base::Bind(&ChunkDemuxerTest::DemuxerOpened, base::Unretained(this)); |
| 160 Demuxer::NeedKeyCB need_key_cb = | 160 Demuxer::NeedKeyCB need_key_cb = |
| 161 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); | 161 base::Bind(&ChunkDemuxerTest::DemuxerNeedKey, base::Unretained(this)); |
| 162 AddTextTrackCB add_text_track_cb = | |
| 163 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this)); | |
| 164 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, | 162 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, |
| 165 add_text_track_cb, LogCB())); | 163 true, LogCB())); |
| 166 } | 164 } |
| 167 | 165 |
| 168 virtual ~ChunkDemuxerTest() { | 166 virtual ~ChunkDemuxerTest() { |
| 169 ShutdownDemuxer(); | 167 ShutdownDemuxer(); |
| 170 } | 168 } |
| 171 | 169 |
| 172 void CreateInitSegment(bool has_audio, bool has_video, | 170 void CreateInitSegment(bool has_audio, bool has_video, |
| 173 bool is_audio_encrypted, bool is_video_encrypted, | 171 bool is_audio_encrypted, bool is_video_encrypted, |
| 174 scoped_ptr<uint8[]>* buffer, | 172 scoped_ptr<uint8[]>* buffer, |
| 175 int* size) { | 173 int* size) { |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use | 852 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use |
| 855 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). | 853 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689). |
| 856 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, | 854 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, |
| 857 const uint8* init_data, int init_data_size)); | 855 const uint8* init_data, int init_data_size)); |
| 858 void DemuxerNeedKey(const std::string& type, | 856 void DemuxerNeedKey(const std::string& type, |
| 859 const std::vector<uint8>& init_data) { | 857 const std::vector<uint8>& init_data) { |
| 860 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; | 858 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; |
| 861 NeedKeyMock(type, init_data_ptr, init_data.size()); | 859 NeedKeyMock(type, init_data_ptr, init_data.size()); |
| 862 } | 860 } |
| 863 | 861 |
| 864 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, | |
| 865 const std::string& label, | |
| 866 const std::string& language) { | |
| 867 return scoped_ptr<TextTrack>(); | |
| 868 } | |
| 869 | |
| 870 void Seek(base::TimeDelta seek_time) { | 862 void Seek(base::TimeDelta seek_time) { |
| 871 demuxer_->StartWaitingForSeek(seek_time); | 863 demuxer_->StartWaitingForSeek(seek_time); |
| 872 demuxer_->Seek(seek_time, NewExpectedStatusCB(PIPELINE_OK)); | 864 demuxer_->Seek(seek_time, NewExpectedStatusCB(PIPELINE_OK)); |
| 873 message_loop_.RunUntilIdle(); | 865 message_loop_.RunUntilIdle(); |
| 874 } | 866 } |
| 875 | 867 |
| 876 void MarkEndOfStream(PipelineStatus status) { | 868 void MarkEndOfStream(PipelineStatus status) { |
| 877 demuxer_->MarkEndOfStream(status); | 869 demuxer_->MarkEndOfStream(status); |
| 878 message_loop_.RunUntilIdle(); | 870 message_loop_.RunUntilIdle(); |
| 879 } | 871 } |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 | 2599 |
| 2608 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { | 2600 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { |
| 2609 ASSERT_TRUE(InitDemuxer(true, true)); | 2601 ASSERT_TRUE(InitDemuxer(true, true)); |
| 2610 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 2602 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 2611 AppendGarbage(); | 2603 AppendGarbage(); |
| 2612 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); | 2604 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); |
| 2613 demuxer_->StartWaitingForSeek(seek_time); | 2605 demuxer_->StartWaitingForSeek(seek_time); |
| 2614 } | 2606 } |
| 2615 | 2607 |
| 2616 } // namespace media | 2608 } // namespace media |
| OLD | NEW |