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

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

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 years, 5 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/filters/ffmpeg_demuxer.cc ('k') | media/filters/ffmpeg_glue_unittest.cc » ('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 18 matching lines...) Expand all
29 using ::testing::SaveArg; 29 using ::testing::SaveArg;
30 using ::testing::SetArgPointee; 30 using ::testing::SetArgPointee;
31 using ::testing::StrictMock; 31 using ::testing::StrictMock;
32 using ::testing::WithArgs; 32 using ::testing::WithArgs;
33 using ::testing::_; 33 using ::testing::_;
34 34
35 namespace media { 35 namespace media {
36 36
37 MATCHER(IsEndOfStreamBuffer, 37 MATCHER(IsEndOfStreamBuffer,
38 std::string(negation ? "isn't" : "is") + " end of stream") { 38 std::string(negation ? "isn't" : "is") + " end of stream") {
39 return arg->IsEndOfStream(); 39 return arg->end_of_stream();
40 } 40 }
41 41
42 static void EosOnReadDone(bool* got_eos_buffer, 42 static void EosOnReadDone(bool* got_eos_buffer,
43 DemuxerStream::Status status, 43 DemuxerStream::Status status,
44 const scoped_refptr<DecoderBuffer>& buffer) { 44 const scoped_refptr<DecoderBuffer>& buffer) {
45 base::MessageLoop::current()->PostTask( 45 base::MessageLoop::current()->PostTask(
46 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 46 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
47 47
48 EXPECT_EQ(status, DemuxerStream::kOk); 48 EXPECT_EQ(status, DemuxerStream::kOk);
49 if (buffer->IsEndOfStream()) { 49 if (buffer->end_of_stream()) {
50 *got_eos_buffer = true; 50 *got_eos_buffer = true;
51 return; 51 return;
52 } 52 }
53 53
54 EXPECT_TRUE(buffer->GetData()); 54 EXPECT_TRUE(buffer->data());
55 EXPECT_GT(buffer->GetDataSize(), 0); 55 EXPECT_GT(buffer->data_size(), 0);
56 *got_eos_buffer = false; 56 *got_eos_buffer = false;
57 }; 57 };
58 58
59 59
60 // Fixture class to facilitate writing tests. Takes care of setting up the 60 // Fixture class to facilitate writing tests. Takes care of setting up the
61 // FFmpeg, pipeline and filter host mocks. 61 // FFmpeg, pipeline and filter host mocks.
62 class FFmpegDemuxerTest : public testing::Test { 62 class FFmpegDemuxerTest : public testing::Test {
63 protected: 63 protected:
64 FFmpegDemuxerTest() {} 64 FFmpegDemuxerTest() {}
65 65
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 int size, int64 timestampInMicroseconds, 104 int size, int64 timestampInMicroseconds,
105 DemuxerStream::Status status, 105 DemuxerStream::Status status,
106 const scoped_refptr<DecoderBuffer>& buffer) { 106 const scoped_refptr<DecoderBuffer>& buffer) {
107 std::string location_str; 107 std::string location_str;
108 location.Write(true, false, &location_str); 108 location.Write(true, false, &location_str);
109 location_str += "\n"; 109 location_str += "\n";
110 SCOPED_TRACE(location_str); 110 SCOPED_TRACE(location_str);
111 EXPECT_EQ(status, DemuxerStream::kOk); 111 EXPECT_EQ(status, DemuxerStream::kOk);
112 OnReadDoneCalled(size, timestampInMicroseconds); 112 OnReadDoneCalled(size, timestampInMicroseconds);
113 EXPECT_TRUE(buffer.get() != NULL); 113 EXPECT_TRUE(buffer.get() != NULL);
114 EXPECT_EQ(size, buffer->GetDataSize()); 114 EXPECT_EQ(size, buffer->data_size());
115 EXPECT_EQ(base::TimeDelta::FromMicroseconds(timestampInMicroseconds), 115 EXPECT_EQ(base::TimeDelta::FromMicroseconds(timestampInMicroseconds),
116 buffer->GetTimestamp()); 116 buffer->timestamp());
117 117
118 DCHECK_EQ(&message_loop_, base::MessageLoop::current()); 118 DCHECK_EQ(&message_loop_, base::MessageLoop::current());
119 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 119 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
120 } 120 }
121 121
122 DemuxerStream::ReadCB NewReadCB(const tracked_objects::Location& location, 122 DemuxerStream::ReadCB NewReadCB(const tracked_objects::Location& location,
123 int size, int64 timestampInMicroseconds) { 123 int size, int64 timestampInMicroseconds) {
124 EXPECT_CALL(*this, OnReadDoneCalled(size, timestampInMicroseconds)); 124 EXPECT_CALL(*this, OnReadDoneCalled(size, timestampInMicroseconds));
125 return base::Bind(&FFmpegDemuxerTest::OnReadDone, base::Unretained(this), 125 return base::Bind(&FFmpegDemuxerTest::OnReadDone, base::Unretained(this),
126 location, size, timestampInMicroseconds); 126 location, size, timestampInMicroseconds);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { 567 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) {
568 #if !defined(USE_PROPRIETARY_CODECS) 568 #if !defined(USE_PROPRIETARY_CODECS)
569 return; 569 return;
570 #endif 570 #endif
571 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); 571 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4");
572 InitializeDemuxer(); 572 InitializeDemuxer();
573 ReadUntilEndOfStream(); 573 ReadUntilEndOfStream();
574 } 574 }
575 575
576 } // namespace media 576 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/ffmpeg_glue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698