OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/filters/pipeline_controller.h" | 5 #include "media/filters/pipeline_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 using ::testing::_; | 21 using ::testing::_; |
22 using ::testing::DoAll; | 22 using ::testing::DoAll; |
23 using ::testing::Mock; | 23 using ::testing::Mock; |
24 using ::testing::NiceMock; | 24 using ::testing::NiceMock; |
25 using ::testing::Return; | 25 using ::testing::Return; |
26 using ::testing::SaveArg; | 26 using ::testing::SaveArg; |
27 using ::testing::StrictMock; | 27 using ::testing::StrictMock; |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
31 class PipelineControllerTest : public ::testing::Test { | 31 class PipelineControllerTest : public ::testing::Test, public Pipeline::Client { |
32 public: | 32 public: |
33 PipelineControllerTest() | 33 PipelineControllerTest() |
34 : pipeline_controller_(&pipeline_, | 34 : pipeline_controller_(&pipeline_, |
35 base::Bind(&PipelineControllerTest::CreateRenderer, | 35 base::Bind(&PipelineControllerTest::CreateRenderer, |
36 base::Unretained(this)), | 36 base::Unretained(this)), |
37 base::Bind(&PipelineControllerTest::OnSeeked, | 37 base::Bind(&PipelineControllerTest::OnSeeked, |
38 base::Unretained(this)), | 38 base::Unretained(this)), |
39 base::Bind(&PipelineControllerTest::OnSuspended, | 39 base::Bind(&PipelineControllerTest::OnSuspended, |
40 base::Unretained(this)), | 40 base::Unretained(this)), |
41 base::Bind(&PipelineControllerTest::OnError, | 41 base::Bind(&PipelineControllerTest::OnError, |
42 base::Unretained(this))) {} | 42 base::Unretained(this))) {} |
43 | 43 |
44 ~PipelineControllerTest() override {} | 44 ~PipelineControllerTest() override {} |
45 | 45 |
46 PipelineStatusCB StartPipeline(bool is_streaming, bool is_static) { | 46 PipelineStatusCB StartPipeline(bool is_streaming, bool is_static) { |
47 EXPECT_FALSE(pipeline_controller_.IsStable()); | 47 EXPECT_FALSE(pipeline_controller_.IsStable()); |
48 PipelineStatusCB start_cb; | 48 PipelineStatusCB start_cb; |
49 EXPECT_CALL(pipeline_, Start(_, _, _, _, _, _, _, _, _, _)) | 49 EXPECT_CALL(pipeline_, Start(_, _, _, _)).WillOnce(SaveArg<3>(&start_cb)); |
50 .WillOnce(SaveArg<4>(&start_cb)); | 50 pipeline_controller_.Start(&demuxer_, this, is_streaming, is_static); |
51 pipeline_controller_.Start(&demuxer_, is_streaming, is_static, | |
52 base::Closure(), PipelineMetadataCB(), | |
53 BufferingStateCB(), base::Closure(), | |
54 AddTextTrackCB(), base::Closure()); | |
55 Mock::VerifyAndClear(&pipeline_); | 51 Mock::VerifyAndClear(&pipeline_); |
56 EXPECT_FALSE(pipeline_controller_.IsStable()); | 52 EXPECT_FALSE(pipeline_controller_.IsStable()); |
57 return start_cb; | 53 return start_cb; |
58 } | 54 } |
59 | 55 |
60 PipelineStatusCB StartPipeline() { return StartPipeline(false, true); } | 56 PipelineStatusCB StartPipeline() { return StartPipeline(false, true); } |
61 | 57 |
62 PipelineStatusCB StartPipeline_WithDynamicData() { | 58 PipelineStatusCB StartPipeline_WithDynamicData() { |
63 return StartPipeline(false, false); | 59 return StartPipeline(false, false); |
64 } | 60 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Request a seek to the same time again. | 306 // Request a seek to the same time again. |
311 pipeline_controller_.Seek(seek_time, true); | 307 pipeline_controller_.Seek(seek_time, true); |
312 message_loop_.RunUntilIdle(); | 308 message_loop_.RunUntilIdle(); |
313 | 309 |
314 // Expect the second seek to trigger when the first seek completes. | 310 // Expect the second seek to trigger when the first seek completes. |
315 EXPECT_CALL(pipeline_, Seek(seek_time, _)); | 311 EXPECT_CALL(pipeline_, Seek(seek_time, _)); |
316 Complete(seek_cb_1); | 312 Complete(seek_cb_1); |
317 } | 313 } |
318 | 314 |
319 } // namespace media | 315 } // namespace media |
OLD | NEW |