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

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

Issue 7193001: Move rtc_video_decoder* from media/filter/ to content/renderer/media/. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' 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
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 "media/base/data_buffer.h" 11 #include "media/base/data_buffer.h"
11 #include "media/base/filters.h" 12 #include "media/base/filters.h"
12 #include "media/base/limits.h" 13 #include "media/base/limits.h"
13 #include "media/base/mock_callback.h" 14 #include "media/base/mock_callback.h"
14 #include "media/base/mock_filter_host.h" 15 #include "media/base/mock_filter_host.h"
15 #include "media/base/mock_filters.h" 16 #include "media/base/mock_filters.h"
16 #include "media/base/mock_task.h" 17 #include "media/base/mock_task.h"
17 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
18 #include "media/filters/rtc_video_decoder.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 using ::testing::_; 21 using ::testing::_;
22 using ::testing::AnyNumber; 22 using ::testing::AnyNumber;
23 using ::testing::DoAll; 23 using ::testing::DoAll;
24 using ::testing::Message; 24 using ::testing::Message;
25 using ::testing::Return; 25 using ::testing::Return;
26 using ::testing::ReturnNull; 26 using ::testing::ReturnNull;
27 using ::testing::SetArgumentPointee; 27 using ::testing::SetArgumentPointee;
28 using ::testing::StrictMock; 28 using ::testing::StrictMock;
29 using ::testing::WithArg; 29 using ::testing::WithArg;
30 using ::testing::Invoke; 30 using ::testing::Invoke;
31 31 using media::Limits;
32 namespace media { 32 using media::MediaFormat;
33 using media::MockStatisticsCallback;
34 using media::MockVideoRenderer;
35 using media::MockFilterHost;
36 using media::NewExpectedCallback;
37 using media::PipelineStatistics;
38 using media::PIPELINE_OK;
39 using media::StatisticsCallback;
33 40
34 class RTCVideoDecoderTest : public testing::Test { 41 class RTCVideoDecoderTest : public testing::Test {
35 protected: 42 protected:
36 static const int kWidth; 43 static const int kWidth;
37 static const int kHeight; 44 static const int kHeight;
38 static const char* kUrl; 45 static const char* kUrl;
39 static const PipelineStatistics kStatistics; 46 static const PipelineStatistics kStatistics;
40 47
41 RTCVideoDecoderTest() { 48 RTCVideoDecoderTest() {
42 MediaFormat media_format; 49 MediaFormat media_format;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::Bind(&RTCVideoDecoder::ProduceVideoFrame, 135 base::Bind(&RTCVideoDecoder::ProduceVideoFrame,
129 base::Unretained(decoder_.get()))); 136 base::Unretained(decoder_.get())));
130 decoder_->Seek(kZero, NewExpectedStatusCB(PIPELINE_OK)); 137 decoder_->Seek(kZero, NewExpectedStatusCB(PIPELINE_OK));
131 138
132 decoder_->set_consume_video_frame_callback( 139 decoder_->set_consume_video_frame_callback(
133 base::Bind(&MockVideoRenderer::ConsumeVideoFrame, 140 base::Bind(&MockVideoRenderer::ConsumeVideoFrame,
134 base::Unretained(renderer_.get()))); 141 base::Unretained(renderer_.get())));
135 EXPECT_CALL(*renderer_.get(), ConsumeVideoFrame(_)) 142 EXPECT_CALL(*renderer_.get(), ConsumeVideoFrame(_))
136 .Times(Limits::kMaxVideoFrames); 143 .Times(Limits::kMaxVideoFrames);
137 144
138 unsigned int video_frame_size = decoder_->width_*decoder_->height_*3/2; 145 unsigned int video_frame_size = decoder_->width_*decoder_->height_*3/2;
scherkus (not reviewing) 2011/06/29 00:39:28 spaces around binary operators (*, /, etc)
Ronghua 2011/06/29 20:36:39 Done.
139 unsigned char* video_frame = new unsigned char[video_frame_size]; 146 unsigned char* video_frame = new unsigned char[video_frame_size];
scherkus (not reviewing) 2011/06/29 00:39:28 uint8
Ronghua 2011/06/29 20:36:39 Done.
140 147
141 for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) { 148 for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) {
142 decoder_->DeliverFrame(video_frame, video_frame_size); 149 decoder_->DeliverFrame(video_frame, video_frame_size);
143 } 150 }
144 delete [] video_frame; 151 delete [] video_frame;
145 152
146 message_loop_.RunAllPending(); 153 message_loop_.RunAllPending();
147 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); 154 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_);
148 } 155 }
149 156
(...skipping 12 matching lines...) Expand all
162 const MediaFormat& media_format = decoder_->media_format(); 169 const MediaFormat& media_format = decoder_->media_format();
163 int width = 0; 170 int width = 0;
164 int height = 0; 171 int height = 0;
165 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width)); 172 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width));
166 EXPECT_EQ(new_width, width); 173 EXPECT_EQ(new_width, width);
167 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height)); 174 EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height));
168 EXPECT_EQ(new_height, height); 175 EXPECT_EQ(new_height, height);
169 176
170 message_loop_.RunAllPending(); 177 message_loop_.RunAllPending();
171 } 178 }
172 179
scherkus (not reviewing) 2011/06/29 00:39:28 nit: blank line
Ronghua 2011/06/29 20:36:39 Done.
173
174 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698