| Index: content/renderer/media/rtc_video_decoder_unittest.cc
|
| ===================================================================
|
| --- content/renderer/media/rtc_video_decoder_unittest.cc (revision 89290)
|
| +++ content/renderer/media/rtc_video_decoder_unittest.cc (working copy)
|
| @@ -7,6 +7,7 @@
|
| #include "base/bind.h"
|
| #include "base/memory/singleton.h"
|
| #include "base/string_util.h"
|
| +#include "content/renderer/media/rtc_video_decoder.h"
|
| #include "media/base/data_buffer.h"
|
| #include "media/base/filters.h"
|
| #include "media/base/limits.h"
|
| @@ -15,7 +16,6 @@
|
| #include "media/base/mock_filters.h"
|
| #include "media/base/mock_task.h"
|
| #include "media/base/video_frame.h"
|
| -#include "media/filters/rtc_video_decoder.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| using ::testing::_;
|
| @@ -29,19 +29,17 @@
|
| using ::testing::WithArg;
|
| using ::testing::Invoke;
|
|
|
| -namespace media {
|
| -
|
| class RTCVideoDecoderTest : public testing::Test {
|
| protected:
|
| static const int kWidth;
|
| static const int kHeight;
|
| static const char* kUrl;
|
| - static const PipelineStatistics kStatistics;
|
| + static const media::PipelineStatistics kStatistics;
|
|
|
| RTCVideoDecoderTest() {
|
| - MediaFormat media_format;
|
| + media::MediaFormat media_format;
|
| decoder_ = new RTCVideoDecoder(&message_loop_, kUrl);
|
| - renderer_ = new MockVideoRenderer();
|
| + renderer_ = new media::MockVideoRenderer();
|
|
|
| DCHECK(decoder_);
|
|
|
| @@ -60,20 +58,20 @@
|
| void InitializeDecoderSuccessfully() {
|
| // Test successful initialization.
|
| decoder_->Initialize(NULL,
|
| - NewExpectedCallback(), NewStatisticsCallback());
|
| + media::NewExpectedCallback(), NewStatisticsCallback());
|
| message_loop_.RunAllPending();
|
| }
|
|
|
| - StatisticsCallback* NewStatisticsCallback() {
|
| + media::StatisticsCallback* NewStatisticsCallback() {
|
| return NewCallback(&stats_callback_object_,
|
| - &MockStatisticsCallback::OnStatistics);
|
| + &media::MockStatisticsCallback::OnStatistics);
|
| }
|
|
|
| // Fixture members.
|
| scoped_refptr<RTCVideoDecoder> decoder_;
|
| - scoped_refptr<MockVideoRenderer> renderer_;
|
| - MockStatisticsCallback stats_callback_object_;
|
| - StrictMock<MockFilterHost> host_;
|
| + scoped_refptr<media::MockVideoRenderer> renderer_;
|
| + media::MockStatisticsCallback stats_callback_object_;
|
| + StrictMock<media::MockFilterHost> host_;
|
| MessageLoop message_loop_;
|
|
|
| private:
|
| @@ -83,19 +81,19 @@
|
| const int RTCVideoDecoderTest::kWidth = 176;
|
| const int RTCVideoDecoderTest::kHeight = 144;
|
| const char* RTCVideoDecoderTest::kUrl = "media://remote/0";
|
| -const PipelineStatistics RTCVideoDecoderTest::kStatistics;
|
| +const media::PipelineStatistics RTCVideoDecoderTest::kStatistics;
|
|
|
| TEST_F(RTCVideoDecoderTest, Initialize_Successful) {
|
| InitializeDecoderSuccessfully();
|
|
|
| // Test that the output media format is an uncompressed video surface that
|
| // matches the dimensions specified by rtc.
|
| - const MediaFormat& media_format = decoder_->media_format();
|
| + const media::MediaFormat& media_format = decoder_->media_format();
|
| int width = 0;
|
| int height = 0;
|
| - EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width));
|
| + EXPECT_TRUE(media_format.GetAsInteger(media::MediaFormat::kWidth, &width));
|
| EXPECT_EQ(kWidth, width);
|
| - EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height));
|
| + EXPECT_TRUE(media_format.GetAsInteger(media::MediaFormat::kHeight, &height));
|
| EXPECT_EQ(kHeight, height);
|
| }
|
|
|
| @@ -105,13 +103,13 @@
|
| InitializeDecoderSuccessfully();
|
|
|
| decoder_->set_consume_video_frame_callback(
|
| - base::Bind(&MockVideoRenderer::ConsumeVideoFrame,
|
| + base::Bind(&media::MockVideoRenderer::ConsumeVideoFrame,
|
| base::Unretained(renderer_.get())));
|
|
|
| // Expect Seek and verify the results.
|
| EXPECT_CALL(*renderer_.get(), ConsumeVideoFrame(_))
|
| - .Times(Limits::kMaxVideoFrames);
|
| - decoder_->Seek(kZero, NewExpectedStatusCB(PIPELINE_OK));
|
| + .Times(media::Limits::kMaxVideoFrames);
|
| + decoder_->Seek(kZero, NewExpectedStatusCB(media::PIPELINE_OK));
|
|
|
| message_loop_.RunAllPending();
|
| EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_);
|
| @@ -127,18 +125,18 @@
|
| decoder_->set_consume_video_frame_callback(
|
| base::Bind(&RTCVideoDecoder::ProduceVideoFrame,
|
| base::Unretained(decoder_.get())));
|
| - decoder_->Seek(kZero, NewExpectedStatusCB(PIPELINE_OK));
|
| + decoder_->Seek(kZero, NewExpectedStatusCB(media::PIPELINE_OK));
|
|
|
| decoder_->set_consume_video_frame_callback(
|
| - base::Bind(&MockVideoRenderer::ConsumeVideoFrame,
|
| + base::Bind(&media::MockVideoRenderer::ConsumeVideoFrame,
|
| base::Unretained(renderer_.get())));
|
| EXPECT_CALL(*renderer_.get(), ConsumeVideoFrame(_))
|
| - .Times(Limits::kMaxVideoFrames);
|
| + .Times(media::Limits::kMaxVideoFrames);
|
|
|
| unsigned int video_frame_size = decoder_->width_*decoder_->height_*3/2;
|
| unsigned char* video_frame = new unsigned char[video_frame_size];
|
|
|
| - for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) {
|
| + for (size_t i = 0; i < media::Limits::kMaxVideoFrames; ++i) {
|
| decoder_->DeliverFrame(video_frame, video_frame_size);
|
| }
|
| delete [] video_frame;
|
| @@ -159,16 +157,13 @@
|
|
|
| decoder_->FrameSizeChange(new_width, new_height, new_number_of_streams);
|
|
|
| - const MediaFormat& media_format = decoder_->media_format();
|
| + const media::MediaFormat& media_format = decoder_->media_format();
|
| int width = 0;
|
| int height = 0;
|
| - EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kWidth, &width));
|
| + EXPECT_TRUE(media_format.GetAsInteger(media::MediaFormat::kWidth, &width));
|
| EXPECT_EQ(new_width, width);
|
| - EXPECT_TRUE(media_format.GetAsInteger(MediaFormat::kHeight, &height));
|
| + EXPECT_TRUE(media_format.GetAsInteger(media::MediaFormat::kHeight, &height));
|
| EXPECT_EQ(new_height, height);
|
|
|
| message_loop_.RunAllPending();
|
| }
|
| -
|
| -
|
| -} // namespace media
|
|
|