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

Unified Diff: media/base/pipeline_impl_unittest.cc

Issue 1769743002: Fix media memory usage reporting after a pipeline suspend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl_unittest.cc
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc
index 33e7a165fe488dd1f10e9ffbdcebecea0a3b7015..3309ded941570093b280b33b7ffa8d9ebf3ced58 100644
--- a/media/base/pipeline_impl_unittest.cc
+++ b/media/base/pipeline_impl_unittest.cc
@@ -175,7 +175,8 @@ class PipelineImplTest : public ::testing::Test {
// Sets up expectations to allow the video renderer to initialize.
void SetRendererExpectations() {
EXPECT_CALL(*renderer_, Initialize(_, _, _, _, _, _, _))
- .WillOnce(DoAll(SaveArg<3>(&buffering_state_cb_),
+ .WillOnce(DoAll(SaveArg<2>(&statistics_cb_),
+ SaveArg<3>(&buffering_state_cb_),
SaveArg<4>(&ended_cb_), PostCallback<1>(PIPELINE_OK)));
EXPECT_CALL(*renderer_, HasAudio()).WillRepeatedly(Return(audio_stream()));
EXPECT_CALL(*renderer_, HasVideo()).WillRepeatedly(Return(video_stream()));
@@ -358,6 +359,7 @@ class PipelineImplTest : public ::testing::Test {
scoped_ptr<FakeTextTrackStream> text_stream_;
BufferingStateCB buffering_state_cb_;
base::Closure ended_cb_;
+ StatisticsCB statistics_cb_;
VideoDecoderConfig video_decoder_config_;
PipelineMetadata metadata_;
base::TimeDelta start_time_;
@@ -599,9 +601,22 @@ TEST_F(PipelineImplTest, SuspendResume) {
StartPipelineAndExpect(PIPELINE_OK);
+ // Inject some fake memory usage to verify its cleared after suspend.
+ PipelineStatistics stats;
+ stats.audio_memory_usage = 12345;
+ stats.video_memory_usage = 67890;
+ statistics_cb_.Run(stats);
+ EXPECT_EQ(stats.audio_memory_usage,
+ pipeline_->GetStatistics().audio_memory_usage);
+ EXPECT_EQ(stats.video_memory_usage,
+ pipeline_->GetStatistics().video_memory_usage);
+
ExpectSuspend();
DoSuspend();
+ EXPECT_EQ(pipeline_->GetStatistics().audio_memory_usage, 0);
+ EXPECT_EQ(pipeline_->GetStatistics().video_memory_usage, 0);
+
base::TimeDelta expected = base::TimeDelta::FromSeconds(2000);
ExpectResume(expected);
DoResume(expected);
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698