Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 13419002: Media Source dispatches inband text tracks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // TODO(matthewjheaney): put something here
785 return scoped_ptr<TextTrack>(0);
786 }
787
778 base::MessageLoop message_loop_; 788 base::MessageLoop message_loop_;
779 MockDemuxerHost host_; 789 MockDemuxerHost host_;
780 790
781 scoped_ptr<ChunkDemuxer> demuxer_; 791 scoped_ptr<ChunkDemuxer> demuxer_;
782 792
783 private: 793 private:
784 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); 794 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest);
785 }; 795 };
786 796
787 TEST_F(ChunkDemuxerTest, TestInit) { 797 TEST_F(ChunkDemuxerTest, TestInit) {
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 // Normally this would return an audio buffer at timestamp zero, but 2469 // Normally this would return an audio buffer at timestamp zero, but
2460 // all reads should return EOS buffers when disabled. 2470 // all reads should return EOS buffers when disabled.
2461 bool audio_read_done = false; 2471 bool audio_read_done = false;
2462 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done)); 2472 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done));
2463 message_loop_.RunUntilIdle(); 2473 message_loop_.RunUntilIdle();
2464 2474
2465 EXPECT_TRUE(audio_read_done); 2475 EXPECT_TRUE(audio_read_done);
2466 } 2476 }
2467 2477
2468 } // namespace media 2478 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698