Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / media / cast / receiver / video_decoder_unittest.cc
index 7ea4b5d..95d92b8 100644 (file)
@@ -12,6 +12,7 @@
 #include "media/cast/cast_config.h"
 #include "media/cast/receiver/video_decoder.h"
 #include "media/cast/sender/vp8_encoder.h"
+#include "media/cast/test/utility/default_config.h"
 #include "media/cast/test/utility/standalone_cast_environment.h"
 #include "media/cast/test/utility/video_utility.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -26,7 +27,7 @@ const int kHeight = 240;
 const int kFrameRate = 10;
 
 VideoSenderConfig GetVideoSenderConfigForTest() {
-  VideoSenderConfig config;
+  VideoSenderConfig config = GetDefaultVideoSenderConfig();
   config.width = kWidth;
   config.height = kHeight;
   config.max_frame_rate = kFrameRate;
@@ -75,7 +76,7 @@ class VideoDecoderTest : public ::testing::TestWithParam<Codec> {
                                 frame_size,
                                 next_frame_timestamp_);
     next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
-    PopulateVideoFrame(video_frame, 0);
+    PopulateVideoFrame(video_frame.get(), 0);
 
     // Encode |frame| into |encoded_frame->data|.
     scoped_ptr<EncodedFrame> encoded_frame(
@@ -83,7 +84,12 @@ class VideoDecoderTest : public ::testing::TestWithParam<Codec> {
     // Test only supports VP8, currently.
     CHECK_EQ(CODEC_VIDEO_VP8, GetParam());
     vp8_encoder_.Encode(video_frame, encoded_frame.get());
+    // Rewrite frame IDs for testing purposes.
     encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
+    if (last_frame_id_ == 0)
+      encoded_frame->referenced_frame_id = encoded_frame->frame_id;
+    else
+      encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
     last_frame_id_ = encoded_frame->frame_id;
 
     {
@@ -121,7 +127,7 @@ class VideoDecoderTest : public ::testing::TestWithParam<Codec> {
     DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
 
     // A NULL |video_frame| indicates a decode error, which we don't expect.
-    ASSERT_FALSE(!video_frame);
+    ASSERT_FALSE(!video_frame.get());
 
     // Did the decoder detect whether frames were dropped?
     EXPECT_EQ(should_be_continuous, is_continuous);