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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 EXPECT_FALSE(pipeline_controller_.IsStable()); | 73 EXPECT_FALSE(pipeline_controller_.IsStable()); |
74 return seek_cb; | 74 return seek_cb; |
75 } | 75 } |
76 | 76 |
77 PipelineStatusCB SuspendPipeline() { | 77 PipelineStatusCB SuspendPipeline() { |
78 EXPECT_TRUE(pipeline_controller_.IsStable()); | 78 EXPECT_TRUE(pipeline_controller_.IsStable()); |
79 PipelineStatusCB suspend_cb; | 79 PipelineStatusCB suspend_cb; |
80 EXPECT_CALL(pipeline_, Suspend(_)).WillOnce(SaveArg<0>(&suspend_cb)); | 80 EXPECT_CALL(pipeline_, Suspend(_)).WillOnce(SaveArg<0>(&suspend_cb)); |
81 pipeline_controller_.Suspend(); | 81 pipeline_controller_.Suspend(); |
82 Mock::VerifyAndClear(&pipeline_); | 82 Mock::VerifyAndClear(&pipeline_); |
| 83 EXPECT_TRUE(pipeline_controller_.IsSuspended()); |
83 EXPECT_FALSE(pipeline_controller_.IsStable()); | 84 EXPECT_FALSE(pipeline_controller_.IsStable()); |
84 EXPECT_FALSE(pipeline_controller_.IsPipelineSuspended()); | 85 EXPECT_FALSE(pipeline_controller_.IsPipelineSuspended()); |
85 return suspend_cb; | 86 return suspend_cb; |
86 } | 87 } |
87 | 88 |
88 PipelineStatusCB ResumePipeline() { | 89 PipelineStatusCB ResumePipeline() { |
89 EXPECT_TRUE(pipeline_controller_.IsPipelineSuspended()); | 90 EXPECT_TRUE(pipeline_controller_.IsPipelineSuspended()); |
90 PipelineStatusCB resume_cb; | 91 PipelineStatusCB resume_cb; |
91 EXPECT_CALL(pipeline_, Resume(_, _, _)) | 92 EXPECT_CALL(pipeline_, Resume(_, _, _)) |
92 .WillOnce( | 93 .WillOnce( |
93 DoAll(SaveArg<1>(&last_resume_time_), SaveArg<2>(&resume_cb))); | 94 DoAll(SaveArg<1>(&last_resume_time_), SaveArg<2>(&resume_cb))); |
94 EXPECT_CALL(pipeline_, GetMediaTime()) | 95 EXPECT_CALL(pipeline_, GetMediaTime()) |
95 .WillRepeatedly(Return(base::TimeDelta())); | 96 .WillRepeatedly(Return(base::TimeDelta())); |
96 pipeline_controller_.Resume(); | 97 pipeline_controller_.Resume(); |
97 Mock::VerifyAndClear(&pipeline_); | 98 Mock::VerifyAndClear(&pipeline_); |
| 99 EXPECT_FALSE(pipeline_controller_.IsSuspended()); |
98 EXPECT_FALSE(pipeline_controller_.IsStable()); | 100 EXPECT_FALSE(pipeline_controller_.IsStable()); |
99 EXPECT_FALSE(pipeline_controller_.IsPipelineSuspended()); | 101 EXPECT_FALSE(pipeline_controller_.IsPipelineSuspended()); |
100 return resume_cb; | 102 return resume_cb; |
101 } | 103 } |
102 | 104 |
103 void Complete(const PipelineStatusCB& cb) { | 105 void Complete(const PipelineStatusCB& cb) { |
104 cb.Run(PIPELINE_OK); | 106 cb.Run(PIPELINE_OK); |
105 base::RunLoop().RunUntilIdle(); | 107 base::RunLoop().RunUntilIdle(); |
106 } | 108 } |
107 | 109 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Request a seek to the same time again. | 319 // Request a seek to the same time again. |
318 pipeline_controller_.Seek(seek_time, true); | 320 pipeline_controller_.Seek(seek_time, true); |
319 base::RunLoop().RunUntilIdle(); | 321 base::RunLoop().RunUntilIdle(); |
320 | 322 |
321 // Expect the second seek to trigger when the first seek completes. | 323 // Expect the second seek to trigger when the first seek completes. |
322 EXPECT_CALL(pipeline_, Seek(seek_time, _)); | 324 EXPECT_CALL(pipeline_, Seek(seek_time, _)); |
323 Complete(seek_cb_1); | 325 Complete(seek_cb_1); |
324 } | 326 } |
325 | 327 |
326 } // namespace media | 328 } // namespace media |
OLD | NEW |