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

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

Issue 1824923002: Revert of media: Stop flushing the renderer for pipeline suspend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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_impl.cc ('k') | no next file » | 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 "media/base/pipeline_impl.h" 5 #include "media/base/pipeline_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 void DoSeek(const base::TimeDelta& seek_time) { 271 void DoSeek(const base::TimeDelta& seek_time) {
272 pipeline_->Seek(seek_time, base::Bind(&CallbackHelper::OnSeek, 272 pipeline_->Seek(seek_time, base::Bind(&CallbackHelper::OnSeek,
273 base::Unretained(&callbacks_))); 273 base::Unretained(&callbacks_)));
274 message_loop_.RunUntilIdle(); 274 message_loop_.RunUntilIdle();
275 } 275 }
276 276
277 void ExpectSuspend() { 277 void ExpectSuspend() {
278 EXPECT_CALL(*renderer_, SetPlaybackRate(0)); 278 EXPECT_CALL(*renderer_, SetPlaybackRate(0));
279 EXPECT_CALL(*renderer_, Flush(_))
280 .WillOnce(DoAll(
281 SetBufferingState(&buffering_state_cb_, BUFFERING_HAVE_NOTHING),
282 RunClosure<0>()));
283 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
279 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK)); 284 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK));
280 } 285 }
281 286
282 void DoSuspend() { 287 void DoSuspend() {
283 pipeline_->Suspend( 288 pipeline_->Suspend(
284 base::Bind(&CallbackHelper::OnSuspend, base::Unretained(&callbacks_))); 289 base::Bind(&CallbackHelper::OnSuspend, base::Unretained(&callbacks_)));
285 message_loop_.RunUntilIdle(); 290 message_loop_.RunUntilIdle();
286 291
287 // |renderer_| has been deleted, replace it. 292 // |renderer_| has been deleted, replace it.
288 scoped_renderer_.reset(new StrictMock<MockRenderer>()), 293 scoped_renderer_.reset(new StrictMock<MockRenderer>()),
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 DoStopOrError(stop_or_error, false); 1074 DoStopOrError(stop_or_error, false);
1070 } 1075 }
1071 1076
1072 PipelineStatus SetSuspendExpectations(TeardownState state, 1077 PipelineStatus SetSuspendExpectations(TeardownState state,
1073 StopOrError stop_or_error) { 1078 StopOrError stop_or_error) {
1074 PipelineStatus status = PIPELINE_OK; 1079 PipelineStatus status = PIPELINE_OK;
1075 base::Closure stop_cb = 1080 base::Closure stop_cb =
1076 base::Bind(&CallbackHelper::OnStop, base::Unretained(&callbacks_)); 1081 base::Bind(&CallbackHelper::OnStop, base::Unretained(&callbacks_));
1077 1082
1078 EXPECT_CALL(*renderer_, SetPlaybackRate(0)); 1083 EXPECT_CALL(*renderer_, SetPlaybackRate(0));
1084 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
1079 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK)); 1085 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK));
1086 EXPECT_CALL(*renderer_, Flush(_))
1087 .WillOnce(DoAll(
1088 SetBufferingState(&buffering_state_cb_, BUFFERING_HAVE_NOTHING),
1089 RunClosure<0>()));
1080 if (state == kResuming) { 1090 if (state == kResuming) {
1081 if (stop_or_error == kStop) { 1091 if (stop_or_error == kStop) {
1082 EXPECT_CALL(*demuxer_, Seek(_, _)) 1092 EXPECT_CALL(*demuxer_, Seek(_, _))
1083 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb), 1093 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb),
1084 RunCallback<1>(PIPELINE_OK))); 1094 RunCallback<1>(PIPELINE_OK)));
1085 EXPECT_CALL(callbacks_, OnResume(PIPELINE_OK)); 1095 EXPECT_CALL(callbacks_, OnResume(PIPELINE_OK));
1086 } else { 1096 } else {
1087 status = PIPELINE_ERROR_READ; 1097 status = PIPELINE_ERROR_READ;
1088 EXPECT_CALL(*demuxer_, Seek(_, _)).WillOnce(RunCallback<1>(status)); 1098 EXPECT_CALL(*demuxer_, Seek(_, _)).WillOnce(RunCallback<1>(status));
1089 EXPECT_CALL(callbacks_, OnResume(status)); 1099 EXPECT_CALL(callbacks_, OnResume(status));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1162 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1153 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1163 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1154 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); 1164 INSTANTIATE_TEARDOWN_TEST(Error, Suspending);
1155 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); 1165 INSTANTIATE_TEARDOWN_TEST(Error, Suspended);
1156 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); 1166 INSTANTIATE_TEARDOWN_TEST(Error, Resuming);
1157 1167
1158 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1168 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1159 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); 1169 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended);
1160 1170
1161 } // namespace media 1171 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698