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

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

Issue 1815423002: media: Stop flushing the renderer for pipeline suspend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing Flush from unittests 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));
284 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK)); 279 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK));
285 } 280 }
286 281
287 void DoSuspend() { 282 void DoSuspend() {
288 pipeline_->Suspend( 283 pipeline_->Suspend(
289 base::Bind(&CallbackHelper::OnSuspend, base::Unretained(&callbacks_))); 284 base::Bind(&CallbackHelper::OnSuspend, base::Unretained(&callbacks_)));
290 message_loop_.RunUntilIdle(); 285 message_loop_.RunUntilIdle();
291 286
292 // |renderer_| has been deleted, replace it. 287 // |renderer_| has been deleted, replace it.
293 scoped_renderer_.reset(new StrictMock<MockRenderer>()), 288 scoped_renderer_.reset(new StrictMock<MockRenderer>()),
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 DoStopOrError(stop_or_error, false); 1069 DoStopOrError(stop_or_error, false);
1075 } 1070 }
1076 1071
1077 PipelineStatus SetSuspendExpectations(TeardownState state, 1072 PipelineStatus SetSuspendExpectations(TeardownState state,
1078 StopOrError stop_or_error) { 1073 StopOrError stop_or_error) {
1079 PipelineStatus status = PIPELINE_OK; 1074 PipelineStatus status = PIPELINE_OK;
1080 base::Closure stop_cb = 1075 base::Closure stop_cb =
1081 base::Bind(&CallbackHelper::OnStop, base::Unretained(&callbacks_)); 1076 base::Bind(&CallbackHelper::OnStop, base::Unretained(&callbacks_));
1082 1077
1083 EXPECT_CALL(*renderer_, SetPlaybackRate(0)); 1078 EXPECT_CALL(*renderer_, SetPlaybackRate(0));
1084 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING));
1085 EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK)); 1079 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>()));
1090 if (state == kResuming) { 1080 if (state == kResuming) {
1091 if (stop_or_error == kStop) { 1081 if (stop_or_error == kStop) {
1092 EXPECT_CALL(*demuxer_, Seek(_, _)) 1082 EXPECT_CALL(*demuxer_, Seek(_, _))
1093 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb), 1083 .WillOnce(DoAll(Stop(pipeline_.get(), stop_cb),
1094 RunCallback<1>(PIPELINE_OK))); 1084 RunCallback<1>(PIPELINE_OK)));
1095 EXPECT_CALL(callbacks_, OnResume(PIPELINE_OK)); 1085 EXPECT_CALL(callbacks_, OnResume(PIPELINE_OK));
1096 } else { 1086 } else {
1097 status = PIPELINE_ERROR_READ; 1087 status = PIPELINE_ERROR_READ;
1098 EXPECT_CALL(*demuxer_, Seek(_, _)).WillOnce(RunCallback<1>(status)); 1088 EXPECT_CALL(*demuxer_, Seek(_, _)).WillOnce(RunCallback<1>(status));
1099 EXPECT_CALL(callbacks_, OnResume(status)); 1089 EXPECT_CALL(callbacks_, OnResume(status));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1152 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1163 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1153 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1164 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); 1154 INSTANTIATE_TEARDOWN_TEST(Error, Suspending);
1165 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); 1155 INSTANTIATE_TEARDOWN_TEST(Error, Suspended);
1166 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); 1156 INSTANTIATE_TEARDOWN_TEST(Error, Resuming);
1167 1157
1168 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1158 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1169 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); 1159 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended);
1170 1160
1171 } // namespace media 1161 } // 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