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

Side by Side Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 7461016: Replace VideoDecoder::media_format() with significantly simpler width()/height() methods. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fixes Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/filters.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) 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/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "content/renderer/media/rtc_video_decoder.h" 10 #include "content/renderer/media/rtc_video_decoder.h"
(...skipping 28 matching lines...) Expand all
39 using media::StatisticsCallback; 39 using media::StatisticsCallback;
40 40
41 class RTCVideoDecoderTest : public testing::Test { 41 class RTCVideoDecoderTest : public testing::Test {
42 protected: 42 protected:
43 static const int kWidth; 43 static const int kWidth;
44 static const int kHeight; 44 static const int kHeight;
45 static const char* kUrl; 45 static const char* kUrl;
46 static const PipelineStatistics kStatistics; 46 static const PipelineStatistics kStatistics;
47 47
48 RTCVideoDecoderTest() { 48 RTCVideoDecoderTest() {
49 MediaFormat media_format;
50 decoder_ = new RTCVideoDecoder(&message_loop_, kUrl); 49 decoder_ = new RTCVideoDecoder(&message_loop_, kUrl);
51 renderer_ = new MockVideoRenderer(); 50 renderer_ = new MockVideoRenderer();
52 51
53 DCHECK(decoder_); 52 DCHECK(decoder_);
54 53
55 // Inject mocks and prepare a demuxer stream. 54 // Inject mocks and prepare a demuxer stream.
56 decoder_->set_host(&host_); 55 decoder_->set_host(&host_);
57 56
58 EXPECT_CALL(stats_callback_object_, OnStatistics(_)) 57 EXPECT_CALL(stats_callback_object_, OnStatistics(_))
59 .Times(AnyNumber()); 58 .Times(AnyNumber());
(...skipping 29 matching lines...) Expand all
89 88
90 const int RTCVideoDecoderTest::kWidth = 176; 89 const int RTCVideoDecoderTest::kWidth = 176;
91 const int RTCVideoDecoderTest::kHeight = 144; 90 const int RTCVideoDecoderTest::kHeight = 144;
92 const char* RTCVideoDecoderTest::kUrl = "media://remote/0"; 91 const char* RTCVideoDecoderTest::kUrl = "media://remote/0";
93 const PipelineStatistics RTCVideoDecoderTest::kStatistics; 92 const PipelineStatistics RTCVideoDecoderTest::kStatistics;
94 93
95 TEST_F(RTCVideoDecoderTest, Initialize_Successful) { 94 TEST_F(RTCVideoDecoderTest, Initialize_Successful) {
96 InitializeDecoderSuccessfully(); 95 InitializeDecoderSuccessfully();
97 96
98 // Test that the output media format is an uncompressed video surface that 97 // Test that the output media format is an uncompressed video surface that
99 // matches the dimensions specified by rtc. 98 // matches the dimensions specified by RTC.
100 const MediaFormat& media_format = decoder_->media_format(); 99 EXPECT_EQ(kWidth, decoder_->width());
101 int width = 0; 100 EXPECT_EQ(kHeight, decoder_->height());
102 int height = 0;
103 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width));
104 EXPECT_EQ(kWidth, width);
105 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height));
106 EXPECT_EQ(kHeight, height);
107 } 101 }
108 102
109 TEST_F(RTCVideoDecoderTest, DoSeek) { 103 TEST_F(RTCVideoDecoderTest, DoSeek) {
110 const base::TimeDelta kZero; 104 const base::TimeDelta kZero;
111 105
112 InitializeDecoderSuccessfully(); 106 InitializeDecoderSuccessfully();
113 107
114 decoder_->set_consume_video_frame_callback( 108 decoder_->set_consume_video_frame_callback(
115 base::Bind(&MockVideoRenderer::ConsumeVideoFrame, 109 base::Bind(&MockVideoRenderer::ConsumeVideoFrame,
116 base::Unretained(renderer_.get()))); 110 base::Unretained(renderer_.get())));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 151
158 int new_width = kWidth * 2; 152 int new_width = kWidth * 2;
159 int new_height = kHeight * 2; 153 int new_height = kHeight * 2;
160 int new_reserved = 0; 154 int new_reserved = 0;
161 155
162 EXPECT_CALL(host_, 156 EXPECT_CALL(host_,
163 SetVideoSize(new_width, new_height)).WillRepeatedly(Return()); 157 SetVideoSize(new_width, new_height)).WillRepeatedly(Return());
164 158
165 decoder_->SetSize(new_width, new_height, new_reserved); 159 decoder_->SetSize(new_width, new_height, new_reserved);
166 160
167 const MediaFormat& media_format = decoder_->media_format(); 161 EXPECT_EQ(new_width, decoder_->width());
168 int width = 0; 162 EXPECT_EQ(new_height, decoder_->height());
169 int height = 0;
170 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width));
171 EXPECT_EQ(new_width, width);
172 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height));
173 EXPECT_EQ(new_height, height);
174 163
175 message_loop_.RunAllPending(); 164 message_loop_.RunAllPending();
176 } 165 }
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698