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

Side by Side Diff: media/filters/ffmpeg_demuxer_unittest.cc

Issue 1409123005: Add methods for telling V8 how much memory audio/video is using. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix html viewer. Created 5 years, 1 month 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/filters/ffmpeg_demuxer.cc ('k') | media/filters/video_renderer_algorithm.h » ('j') | 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 <algorithm> 5 #include <algorithm>
6 #include <deque> 6 #include <deque>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 InitializeDemuxer(); 392 InitializeDemuxer();
393 393
394 // Attempt a read from the audio stream and run the message loop until done. 394 // Attempt a read from the audio stream and run the message loop until done.
395 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO); 395 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO);
396 396
397 audio->Read(NewReadCB(FROM_HERE, 29, 0, true)); 397 audio->Read(NewReadCB(FROM_HERE, 29, 0, true));
398 message_loop_.Run(); 398 message_loop_.Run();
399 399
400 audio->Read(NewReadCB(FROM_HERE, 27, 3000, true)); 400 audio->Read(NewReadCB(FROM_HERE, 27, 3000, true));
401 message_loop_.Run(); 401 message_loop_.Run();
402
403 EXPECT_EQ(22084, demuxer_->GetMemoryUsage());
402 } 404 }
403 405
404 TEST_F(FFmpegDemuxerTest, Read_Video) { 406 TEST_F(FFmpegDemuxerTest, Read_Video) {
405 // We test that on a successful video packet read. 407 // We test that on a successful video packet read.
406 CreateDemuxer("bear-320x240.webm"); 408 CreateDemuxer("bear-320x240.webm");
407 InitializeDemuxer(); 409 InitializeDemuxer();
408 410
409 // Attempt a read from the video stream and run the message loop until done. 411 // Attempt a read from the video stream and run the message loop until done.
410 DemuxerStream* video = demuxer_->GetStream(DemuxerStream::VIDEO); 412 DemuxerStream* video = demuxer_->GetStream(DemuxerStream::VIDEO);
411 413
412 video->Read(NewReadCB(FROM_HERE, 22084, 0, true)); 414 video->Read(NewReadCB(FROM_HERE, 22084, 0, true));
413 message_loop_.Run(); 415 message_loop_.Run();
414 416
415 video->Read(NewReadCB(FROM_HERE, 1057, 33000, false)); 417 video->Read(NewReadCB(FROM_HERE, 1057, 33000, false));
416 message_loop_.Run(); 418 message_loop_.Run();
419
420 EXPECT_EQ(323, demuxer_->GetMemoryUsage());
417 } 421 }
418 422
419 TEST_F(FFmpegDemuxerTest, Read_Text) { 423 TEST_F(FFmpegDemuxerTest, Read_Text) {
420 // We test that on a successful text packet read. 424 // We test that on a successful text packet read.
421 CreateDemuxer("bear-vp8-webvtt.webm"); 425 CreateDemuxer("bear-vp8-webvtt.webm");
422 DemuxerStream* text_stream = NULL; 426 DemuxerStream* text_stream = NULL;
423 EXPECT_CALL(host_, AddTextStream(_, _)) 427 EXPECT_CALL(host_, AddTextStream(_, _))
424 .WillOnce(SaveArg<0>(&text_stream)); 428 .WillOnce(SaveArg<0>(&text_stream));
425 InitializeDemuxerText(true); 429 InitializeDemuxerText(true);
426 ASSERT_TRUE(text_stream); 430 ASSERT_TRUE(text_stream);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1122
1119 video->Read(NewReadCB(FROM_HERE, 3569, 66733, true)); 1123 video->Read(NewReadCB(FROM_HERE, 3569, 66733, true));
1120 message_loop_.Run(); 1124 message_loop_.Run();
1121 1125
1122 video->Read(NewReadCB(FROM_HERE, 1042, 200200, false)); 1126 video->Read(NewReadCB(FROM_HERE, 1042, 200200, false));
1123 message_loop_.Run(); 1127 message_loop_.Run();
1124 } 1128 }
1125 #endif 1129 #endif
1126 1130
1127 } // namespace media 1131 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/video_renderer_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698