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 <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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 base::Bind(&CallbackHelper::OnSeek, | 308 base::Bind(&CallbackHelper::OnSeek, |
309 base::Unretained(&callbacks_))); | 309 base::Unretained(&callbacks_))); |
310 | 310 |
311 // We expect the time to be updated only after the seek has completed. | 311 // We expect the time to be updated only after the seek has completed. |
312 EXPECT_NE(seek_time, pipeline_->GetMediaTime()); | 312 EXPECT_NE(seek_time, pipeline_->GetMediaTime()); |
313 message_loop_.RunUntilIdle(); | 313 message_loop_.RunUntilIdle(); |
314 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); | 314 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
315 } | 315 } |
316 | 316 |
317 void DestroyPipeline() { | 317 void DestroyPipeline() { |
| 318 // In real code Pipeline could be destroyed on a different thread. All weak |
| 319 // pointers must have been invalidated before the stop callback returns. |
| 320 DCHECK(!pipeline_->HasWeakPtrsForTesting()); |
318 pipeline_.reset(); | 321 pipeline_.reset(); |
319 } | 322 } |
320 | 323 |
321 void ExpectDemuxerStop() { | 324 void ExpectDemuxerStop() { |
322 if (demuxer_) | 325 if (demuxer_) |
323 EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>()); | 326 EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>()); |
324 } | 327 } |
325 | 328 |
326 void ExpectPipelineStopAndDestroyPipeline() { | 329 void ExpectPipelineStopAndDestroyPipeline() { |
327 // After the Pipeline is stopped, it could be destroyed any time. Always | 330 // After the Pipeline is stopped, it could be destroyed any time. Always |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); | 1247 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); |
1245 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); | 1248 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); |
1246 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); | 1249 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); |
1247 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); | 1250 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); |
1248 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1251 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
1249 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1252 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
1250 | 1253 |
1251 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1254 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
1252 | 1255 |
1253 } // namespace media | 1256 } // namespace media |
OLD | NEW |