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

Side by Side Diff: media/base/pipeline_unittest.cc

Issue 212803004: Separate DemuxerHost from DataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 8 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
« no previous file with comments | « media/base/pipeline.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('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 <vector> 5 #include <vector>
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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 20 matching lines...) Expand all
31 using ::testing::InvokeWithoutArgs; 31 using ::testing::InvokeWithoutArgs;
32 using ::testing::Mock; 32 using ::testing::Mock;
33 using ::testing::NotNull; 33 using ::testing::NotNull;
34 using ::testing::Return; 34 using ::testing::Return;
35 using ::testing::SaveArg; 35 using ::testing::SaveArg;
36 using ::testing::StrictMock; 36 using ::testing::StrictMock;
37 using ::testing::WithArg; 37 using ::testing::WithArg;
38 38
39 namespace media { 39 namespace media {
40 40
41 // Demuxer properties.
42 const int kTotalBytes = 1024; 41 const int kTotalBytes = 1024;
43 42
44 ACTION_P(SetDemuxerProperties, duration) { 43 ACTION_P(SetDemuxerProperties, duration) {
45 arg0->SetTotalBytes(kTotalBytes);
46 arg0->SetDuration(duration); 44 arg0->SetDuration(duration);
47 } 45 }
48 46
49 ACTION_P2(Stop, pipeline, stop_cb) { 47 ACTION_P2(Stop, pipeline, stop_cb) {
50 pipeline->Stop(stop_cb); 48 pipeline->Stop(stop_cb);
51 } 49 }
52 50
53 ACTION_P2(SetError, pipeline, status) { 51 ACTION_P2(SetError, pipeline, status) {
54 pipeline->SetErrorForTesting(status); 52 pipeline->SetErrorForTesting(status);
55 } 53 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 210
213 // Startup sequence. 211 // Startup sequence.
214 EXPECT_CALL(*audio_renderer_, Preroll(base::TimeDelta(), _)) 212 EXPECT_CALL(*audio_renderer_, Preroll(base::TimeDelta(), _))
215 .WillOnce(RunCallback<1>(PIPELINE_OK)); 213 .WillOnce(RunCallback<1>(PIPELINE_OK));
216 EXPECT_CALL(*audio_renderer_, Play(_)) 214 EXPECT_CALL(*audio_renderer_, Play(_))
217 .WillOnce(RunClosure<0>()); 215 .WillOnce(RunClosure<0>());
218 } 216 }
219 EXPECT_CALL(callbacks_, OnPrerollCompleted()); 217 EXPECT_CALL(callbacks_, OnPrerollCompleted());
220 } 218 }
221 219
220 // HACK: This is required to test the time range code now that DemuxerHost
221 // does not include SetTotalBytes(). The test cases that depend on this will
222 // be moved out of pipeline_unittest when Pipeline stops implementing
223 // DataSourceHost, see http://crbug.com/122071.
224 DataSourceHost* host = pipeline_.get();
225 host->SetTotalBytes(kTotalBytes);
226
222 pipeline_->Start( 227 pipeline_->Start(
223 filter_collection_.Pass(), 228 filter_collection_.Pass(),
224 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), 229 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)),
225 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), 230 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)),
226 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), 231 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)),
227 base::Bind(&CallbackHelper::OnMetadata, base::Unretained(&callbacks_)), 232 base::Bind(&CallbackHelper::OnMetadata, base::Unretained(&callbacks_)),
228 base::Bind(&CallbackHelper::OnPrerollCompleted, 233 base::Bind(&CallbackHelper::OnPrerollCompleted,
229 base::Unretained(&callbacks_)), 234 base::Unretained(&callbacks_)),
230 base::Bind(&CallbackHelper::OnDurationChange, 235 base::Bind(&CallbackHelper::OnDurationChange,
231 base::Unretained(&callbacks_))); 236 base::Unretained(&callbacks_)));
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 INSTANTIATE_TEARDOWN_TEST(Error, Pausing); 1269 INSTANTIATE_TEARDOWN_TEST(Error, Pausing);
1265 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); 1270 INSTANTIATE_TEARDOWN_TEST(Error, Flushing);
1266 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1271 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1267 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling); 1272 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling);
1268 INSTANTIATE_TEARDOWN_TEST(Error, Starting); 1273 INSTANTIATE_TEARDOWN_TEST(Error, Starting);
1269 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1274 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1270 1275
1271 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1276 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1272 1277
1273 } // namespace media 1278 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698