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

Side by Side Diff: media/cast/video_receiver/video_decoder_unittest.cc

Issue 116623002: Cast: Adding support for GPU accelerated encode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge nits Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/test/simple_test_tick_clock.h" 7 #include "base/test/simple_test_tick_clock.h"
8 #include "base/time/tick_clock.h" 8 #include "base/time/tick_clock.h"
9 #include "media/cast/cast_config.h" 9 #include "media/cast/cast_config.h"
10 #include "media/cast/cast_defines.h" 10 #include "media/cast/cast_defines.h"
11 #include "media/cast/cast_environment.h" 11 #include "media/cast/cast_environment.h"
12 #include "media/cast/cast_receiver.h" 12 #include "media/cast/cast_receiver.h"
13 #include "media/cast/test/fake_task_runner.h" 13 #include "media/cast/test/fake_task_runner.h"
14 #include "media/cast/video_receiver/video_decoder.h" 14 #include "media/cast/video_receiver/video_decoder.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 16
17 namespace media { 17 namespace media {
18 namespace cast { 18 namespace cast {
19 19
20 using testing::_; 20 using testing::_;
21 21
22 // Random frame size for testing. 22 // Random frame size for testing.
23 const int kFrameSize = 2345;
24 static const int64 kStartMillisecond = GG_INT64_C(1245); 23 static const int64 kStartMillisecond = GG_INT64_C(1245);
25 24
26 namespace { 25 namespace {
27 class DecodeTestFrameCallback : 26 class DecodeTestFrameCallback :
28 public base::RefCountedThreadSafe<DecodeTestFrameCallback> { 27 public base::RefCountedThreadSafe<DecodeTestFrameCallback> {
29 public: 28 public:
30 DecodeTestFrameCallback() {} 29 DecodeTestFrameCallback() {}
31 30
32 void DecodeComplete(const scoped_refptr<media::VideoFrame>& decoded_frame, 31 void DecodeComplete(const scoped_refptr<media::VideoFrame>& decoded_frame,
33 const base::TimeTicks& render_time) {} 32 const base::TimeTicks& render_time) {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 EncodedVideoFrame encoded_frame; 68 EncodedVideoFrame encoded_frame;
70 base::TimeTicks render_time; 69 base::TimeTicks render_time;
71 encoded_frame.codec = kVp8; 70 encoded_frame.codec = kVp8;
72 EXPECT_DEATH( 71 EXPECT_DEATH(
73 decoder_->DecodeVideoFrame( 72 decoder_->DecodeVideoFrame(
74 &encoded_frame, render_time, 73 &encoded_frame, render_time,
75 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)), 74 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)),
76 "Empty frame"); 75 "Empty frame");
77 } 76 }
78 77
79 // TODO(pwestin): EXPECT_DEATH tests can not pass valgrind.
80 TEST_F(VideoDecoderTest, DISABLED_InvalidCodec) {
81 EncodedVideoFrame encoded_frame;
82 base::TimeTicks render_time;
83 encoded_frame.data.assign(kFrameSize, 0);
84 encoded_frame.codec = kExternalVideo;
85 EXPECT_DEATH(
86 decoder_->DecodeVideoFrame(&encoded_frame, render_time, base::Bind(
87 &DecodeTestFrameCallback::DecodeComplete, test_callback_)),
88 "Invalid codec");
89 }
90
91 // TODO(pwestin): Test decoding a real frame. 78 // TODO(pwestin): Test decoding a real frame.
92 79
93 } // namespace cast 80 } // namespace cast
94 } // namespace media 81 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_receiver/video_decoder.cc ('k') | media/cast/video_sender/codecs/vp8/vp8_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698