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

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

Issue 8351045: Change DemuxerStream::ReadCallback to use ref-counted buffers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: forgot some &s Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <deque> 5 #include <deque>
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "media/base/filters.h" 10 #include "media/base/filters.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // is mocked we don't need to pass in object or method pointers. 382 // is mocked we don't need to pass in object or method pointers.
383 class MockReadCallback : public base::RefCountedThreadSafe<MockReadCallback> { 383 class MockReadCallback : public base::RefCountedThreadSafe<MockReadCallback> {
384 public: 384 public:
385 MockReadCallback() {} 385 MockReadCallback() {}
386 386
387 virtual ~MockReadCallback() { 387 virtual ~MockReadCallback() {
388 OnDelete(); 388 OnDelete();
389 } 389 }
390 390
391 MOCK_METHOD0(OnDelete, void()); 391 MOCK_METHOD0(OnDelete, void());
392 MOCK_METHOD1(Run, void(Buffer* buffer)); 392 MOCK_METHOD1(Run, void(const scoped_refptr<Buffer>& buffer));
393 393
394 private: 394 private:
395 DISALLOW_COPY_AND_ASSIGN(MockReadCallback); 395 DISALLOW_COPY_AND_ASSIGN(MockReadCallback);
396 }; 396 };
397 397
398 TEST_F(FFmpegDemuxerTest, Stop) { 398 TEST_F(FFmpegDemuxerTest, Stop) {
399 // Tests that calling Read() on a stopped demuxer stream immediately deletes 399 // Tests that calling Read() on a stopped demuxer stream immediately deletes
400 // the callback. 400 // the callback.
401 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); 401 InitializeDemuxer(CreateDataSource("bear-320x240.webm"));
402 402
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 message_loop_.RunAllPending(); 696 message_loop_.RunAllPending();
697 EXPECT_TRUE(reader->called()); 697 EXPECT_TRUE(reader->called());
698 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000); 698 ValidateBuffer(FROM_HERE, reader->buffer(), 1740, 2436000);
699 699
700 // Manually release the last reference to the buffer and verify it was freed. 700 // Manually release the last reference to the buffer and verify it was freed.
701 reader->Reset(); 701 reader->Reset();
702 message_loop_.RunAllPending(); 702 message_loop_.RunAllPending();
703 } 703 }
704 704
705 } // namespace media 705 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698