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

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

Issue 23072043: Change NeedKeyCB to use std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix seek_tester, demuxer_bench, and player_x11 Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return GenerateCluster(46, 66, 5); 150 return GenerateCluster(46, 66, 5);
151 } 151 }
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 ChunkDemuxer::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 = 162 AddTextTrackCB add_text_track_cb =
163 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this)); 163 base::Bind(&ChunkDemuxerTest::OnTextTrack, base::Unretained(this));
164 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb, 164 demuxer_.reset(new ChunkDemuxer(open_cb, need_key_cb,
165 add_text_track_cb, LogCB())); 165 add_text_track_cb, LogCB()));
166 } 166 }
167 167
168 virtual ~ChunkDemuxerTest() { 168 virtual ~ChunkDemuxerTest() {
169 ShutdownDemuxer(); 169 ShutdownDemuxer();
170 } 170 }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 } 849 }
850 850
851 MOCK_METHOD0(DemuxerOpened, void()); 851 MOCK_METHOD0(DemuxerOpened, void());
852 // TODO(xhwang): This is a workaround of the issue that move-only parameters 852 // TODO(xhwang): This is a workaround of the issue that move-only parameters
853 // are not supported in mocked methods. Remove this when the issue is fixed 853 // are not supported in mocked methods. Remove this when the issue is fixed
854 // (http://code.google.com/p/googletest/issues/detail?id=395) or when we use 854 // (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). 855 // std::string instead of scoped_ptr<uint8[]> (http://crbug.com/130689).
856 MOCK_METHOD3(NeedKeyMock, void(const std::string& type, 856 MOCK_METHOD3(NeedKeyMock, void(const std::string& type,
857 const uint8* init_data, int init_data_size)); 857 const uint8* init_data, int init_data_size));
858 void DemuxerNeedKey(const std::string& type, 858 void DemuxerNeedKey(const std::string& type,
859 scoped_ptr<uint8[]> init_data, int init_data_size) { 859 const std::vector<uint8>& init_data) {
860 NeedKeyMock(type, init_data.get(), init_data_size); 860 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0];
861 NeedKeyMock(type, init_data_ptr, init_data.size());
861 } 862 }
862 863
863 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, 864 scoped_ptr<TextTrack> OnTextTrack(TextKind kind,
864 const std::string& label, 865 const std::string& label,
865 const std::string& language) { 866 const std::string& language) {
866 return scoped_ptr<TextTrack>(); 867 return scoped_ptr<TextTrack>();
867 } 868 }
868 869
869 void Seek(base::TimeDelta seek_time) { 870 void Seek(base::TimeDelta seek_time) {
870 demuxer_->StartWaitingForSeek(seek_time); 871 demuxer_->StartWaitingForSeek(seek_time);
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 2607
2607 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { 2608 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) {
2608 ASSERT_TRUE(InitDemuxer(true, true)); 2609 ASSERT_TRUE(InitDemuxer(true, true));
2609 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); 2610 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE));
2610 AppendGarbage(); 2611 AppendGarbage();
2611 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); 2612 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50);
2612 demuxer_->StartWaitingForSeek(seek_time); 2613 demuxer_->StartWaitingForSeek(seek_time);
2613 } 2614 }
2614 2615
2615 } // namespace media 2616 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698