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

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

Issue 145443005: Fixes for memory and threading issues in cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/test/sender.cc ('k') | media/cast/video_receiver/video_receiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 22 matching lines...) Expand all
33 protected: 33 protected:
34 virtual ~DecodeTestFrameCallback() {} 34 virtual ~DecodeTestFrameCallback() {}
35 private: 35 private:
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 : testing_clock_(new base::SimpleTestTickClock()),
44 cast_environment_(new CastEnvironment(&testing_clock_, task_runner_, 44 task_runner_(new test::FakeTaskRunner(testing_clock_)),
45 task_runner_, task_runner_, task_runner_, task_runner_, 45 cast_environment_(new CastEnvironment(
46 task_runner_, GetDefaultCastReceiverLoggingConfig())), 46 scoped_ptr<base::TickClock>(testing_clock_), task_runner_,
47 test_callback_(new DecodeTestFrameCallback()) { 47 task_runner_, task_runner_, task_runner_, task_runner_,
48 task_runner_, GetDefaultCastReceiverLoggingConfig())),
49 test_callback_(new DecodeTestFrameCallback()) {
48 // Configure to vp8. 50 // Configure to vp8.
49 config_.codec = transport::kVp8; 51 config_.codec = transport::kVp8;
50 config_.use_external_decoder = false; 52 config_.use_external_decoder = false;
51 decoder_.reset(new VideoDecoder(config_, cast_environment_)); 53 decoder_.reset(new VideoDecoder(config_, cast_environment_));
52 testing_clock_.Advance( 54 testing_clock_->Advance(
53 base::TimeDelta::FromMilliseconds(kStartMillisecond)); 55 base::TimeDelta::FromMilliseconds(kStartMillisecond));
54 } 56 }
55 57
56 virtual ~VideoDecoderTest() {} 58 virtual ~VideoDecoderTest() {}
57 59
58 scoped_ptr<VideoDecoder> decoder_; 60 scoped_ptr<VideoDecoder> decoder_;
59 VideoReceiverConfig config_; 61 VideoReceiverConfig config_;
60 base::SimpleTestTickClock testing_clock_; 62 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
61 scoped_refptr<test::FakeTaskRunner> task_runner_; 63 scoped_refptr<test::FakeTaskRunner> task_runner_;
62 scoped_refptr<CastEnvironment> cast_environment_; 64 scoped_refptr<CastEnvironment> cast_environment_;
63 scoped_refptr<DecodeTestFrameCallback> test_callback_; 65 scoped_refptr<DecodeTestFrameCallback> test_callback_;
64 }; 66 };
65 67
66 // TODO(pwestin): EXPECT_DEATH tests can not pass valgrind. 68 // TODO(pwestin): EXPECT_DEATH tests can not pass valgrind.
67 TEST_F(VideoDecoderTest, DISABLED_SizeZero) { 69 TEST_F(VideoDecoderTest, DISABLED_SizeZero) {
68 transport::EncodedVideoFrame encoded_frame; 70 transport::EncodedVideoFrame encoded_frame;
69 base::TimeTicks render_time; 71 base::TimeTicks render_time;
70 encoded_frame.codec = transport::kVp8; 72 encoded_frame.codec = transport::kVp8;
71 EXPECT_DEATH( 73 EXPECT_DEATH(
72 decoder_->DecodeVideoFrame( 74 decoder_->DecodeVideoFrame(
73 &encoded_frame, render_time, 75 &encoded_frame, render_time,
74 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)), 76 base::Bind(&DecodeTestFrameCallback::DecodeComplete, test_callback_)),
75 "Empty frame"); 77 "Empty frame");
76 } 78 }
77 79
78 // TODO(pwestin): Test decoding a real frame. 80 // TODO(pwestin): Test decoding a real frame.
79 81
80 } // namespace cast 82 } // namespace cast
81 } // namespace media 83 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/sender.cc ('k') | media/cast/video_receiver/video_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698