OLD | NEW |
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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 friend class base::RefCountedThreadSafe<DecodeTestFrameCallback>; | 36 friend class base::RefCountedThreadSafe<DecodeTestFrameCallback>; |
37 }; | 37 }; |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 class VideoDecoderTest : public ::testing::Test { | 40 class VideoDecoderTest : public ::testing::Test { |
41 protected: | 41 protected: |
42 VideoDecoderTest() | 42 VideoDecoderTest() |
43 : task_runner_(new test::FakeTaskRunner(&testing_clock_)), | 43 : task_runner_(new test::FakeTaskRunner(&testing_clock_)), |
44 cast_environment_(new CastEnvironment(&testing_clock_, task_runner_, | 44 cast_environment_(new CastEnvironment(&testing_clock_, task_runner_, |
45 task_runner_, task_runner_, task_runner_, task_runner_, | 45 task_runner_, task_runner_, task_runner_, task_runner_, |
46 GetDefaultCastLoggingConfig())), | 46 task_runner_, GetDefaultCastLoggingConfig())), |
47 test_callback_(new DecodeTestFrameCallback()) { | 47 test_callback_(new DecodeTestFrameCallback()) { |
48 // Configure to vp8. | 48 // Configure to vp8. |
49 config_.codec = kVp8; | 49 config_.codec = transport::kVp8; |
50 config_.use_external_decoder = false; | 50 config_.use_external_decoder = false; |
51 decoder_.reset(new VideoDecoder(config_, cast_environment_)); | 51 decoder_.reset(new VideoDecoder(config_, cast_environment_)); |
52 testing_clock_.Advance( | 52 testing_clock_.Advance( |
53 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 53 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
54 } | 54 } |
55 | 55 |
56 virtual ~VideoDecoderTest() {} | 56 virtual ~VideoDecoderTest() {} |
57 | 57 |
58 scoped_ptr<VideoDecoder> decoder_; | 58 scoped_ptr<VideoDecoder> decoder_; |
59 VideoReceiverConfig config_; | 59 VideoReceiverConfig config_; |
60 base::SimpleTestTickClock testing_clock_; | 60 base::SimpleTestTickClock testing_clock_; |
61 scoped_refptr<test::FakeTaskRunner> task_runner_; | 61 scoped_refptr<test::FakeTaskRunner> task_runner_; |
62 scoped_refptr<CastEnvironment> cast_environment_; | 62 scoped_refptr<CastEnvironment> cast_environment_; |
63 scoped_refptr<DecodeTestFrameCallback> test_callback_; | 63 scoped_refptr<DecodeTestFrameCallback> test_callback_; |
64 }; | 64 }; |
65 | 65 |
66 // TODO(pwestin): EXPECT_DEATH tests can not pass valgrind. | 66 // TODO(pwestin): EXPECT_DEATH tests can not pass valgrind. |
67 TEST_F(VideoDecoderTest, DISABLED_SizeZero) { | 67 TEST_F(VideoDecoderTest, DISABLED_SizeZero) { |
68 EncodedVideoFrame encoded_frame; | 68 transport::EncodedVideoFrame encoded_frame; |
69 base::TimeTicks render_time; | 69 base::TimeTicks render_time; |
70 encoded_frame.codec = kVp8; | 70 encoded_frame.codec = transport::kVp8; |
71 EXPECT_DEATH( | 71 EXPECT_DEATH( |
72 decoder_->DecodeVideoFrame( | 72 decoder_->DecodeVideoFrame( |
73 &encoded_frame, render_time, | 73 &encoded_frame, render_time, |
74 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)), | 74 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)), |
75 "Empty frame"); | 75 "Empty frame"); |
76 } | 76 } |
77 | 77 |
78 // TODO(pwestin): Test decoding a real frame. | 78 // TODO(pwestin): Test decoding a real frame. |
79 | 79 |
80 } // namespace cast | 80 } // namespace cast |
81 } // namespace media | 81 } // namespace media |
OLD | NEW |