| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 .WillOnce(PostCallback<1>(PIPELINE_ERROR_URL_NOT_FOUND)); | 416 .WillOnce(PostCallback<1>(PIPELINE_ERROR_URL_NOT_FOUND)); |
| 417 EXPECT_CALL(*demuxer_, Stop()); | 417 EXPECT_CALL(*demuxer_, Stop()); |
| 418 | 418 |
| 419 StartPipelineAndExpect(PIPELINE_ERROR_URL_NOT_FOUND); | 419 StartPipelineAndExpect(PIPELINE_ERROR_URL_NOT_FOUND); |
| 420 } | 420 } |
| 421 | 421 |
| 422 TEST_F(PipelineTest, NoStreams) { | 422 TEST_F(PipelineTest, NoStreams) { |
| 423 EXPECT_CALL(*demuxer_, Initialize(_, _, _)) | 423 EXPECT_CALL(*demuxer_, Initialize(_, _, _)) |
| 424 .WillOnce(PostCallback<1>(PIPELINE_OK)); | 424 .WillOnce(PostCallback<1>(PIPELINE_OK)); |
| 425 EXPECT_CALL(*demuxer_, Stop()); | 425 EXPECT_CALL(*demuxer_, Stop()); |
| 426 EXPECT_CALL(callbacks_, OnMetadata(_)); |
| 426 | 427 |
| 427 StartPipelineAndExpect(PIPELINE_ERROR_COULD_NOT_RENDER); | 428 StartPipelineAndExpect(PIPELINE_ERROR_COULD_NOT_RENDER); |
| 428 } | 429 } |
| 429 | 430 |
| 430 TEST_F(PipelineTest, AudioStream) { | 431 TEST_F(PipelineTest, AudioStream) { |
| 431 CreateAudioStream(); | 432 CreateAudioStream(); |
| 432 MockDemuxerStreamVector streams; | 433 MockDemuxerStreamVector streams; |
| 433 streams.push_back(audio_stream()); | 434 streams.push_back(audio_stream()); |
| 434 | 435 |
| 435 SetDemuxerExpectations(&streams); | 436 SetDemuxerExpectations(&streams); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb), | 861 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb), |
| 861 PostCallback<1>(PIPELINE_OK))); | 862 PostCallback<1>(PIPELINE_OK))); |
| 862 ExpectPipelineStopAndDestroyPipeline(); | 863 ExpectPipelineStopAndDestroyPipeline(); |
| 863 } else { | 864 } else { |
| 864 status = PIPELINE_ERROR_INITIALIZATION_FAILED; | 865 status = PIPELINE_ERROR_INITIALIZATION_FAILED; |
| 865 EXPECT_CALL(*renderer_, Initialize(_, _, _, _, _, _, _)) | 866 EXPECT_CALL(*renderer_, Initialize(_, _, _, _, _, _, _)) |
| 866 .WillOnce(PostCallback<1>(status)); | 867 .WillOnce(PostCallback<1>(status)); |
| 867 } | 868 } |
| 868 | 869 |
| 869 EXPECT_CALL(*demuxer_, Stop()); | 870 EXPECT_CALL(*demuxer_, Stop()); |
| 871 EXPECT_CALL(callbacks_, OnMetadata(_)); |
| 870 return status; | 872 return status; |
| 871 } | 873 } |
| 872 | 874 |
| 873 EXPECT_CALL(*renderer_, Initialize(_, _, _, _, _, _, _)) | 875 EXPECT_CALL(*renderer_, Initialize(_, _, _, _, _, _, _)) |
| 874 .WillOnce(DoAll(SaveArg<3>(&buffering_state_cb_), | 876 .WillOnce(DoAll(SaveArg<3>(&buffering_state_cb_), |
| 875 PostCallback<1>(PIPELINE_OK))); | 877 PostCallback<1>(PIPELINE_OK))); |
| 876 | 878 |
| 877 EXPECT_CALL(callbacks_, OnMetadata(_)); | 879 EXPECT_CALL(callbacks_, OnMetadata(_)); |
| 878 | 880 |
| 879 // If we get here it's a successful initialization. | 881 // If we get here it's a successful initialization. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1004 |
| 1003 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); | 1005 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); |
| 1004 INSTANTIATE_TEARDOWN_TEST(Error, InitRenderer); | 1006 INSTANTIATE_TEARDOWN_TEST(Error, InitRenderer); |
| 1005 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); | 1007 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); |
| 1006 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1008 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
| 1007 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1009 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
| 1008 | 1010 |
| 1009 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); | 1011 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); |
| 1010 | 1012 |
| 1011 } // namespace media | 1013 } // namespace media |
| OLD | NEW |