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

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

Issue 25546003: Revert 226264 "Be able to build cast_unittest and related target..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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
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/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
10 #include "media/cast/cast_thread.h" 10 #include "media/cast/cast_thread.h"
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 TestVideoDecoderCallback() 30 TestVideoDecoderCallback()
31 : num_called_(0) {} 31 : num_called_(0) {}
32 // TODO(mikhal): Set and check expectations. 32 // TODO(mikhal): Set and check expectations.
33 void DecodeComplete(scoped_ptr<I420VideoFrame> frame, 33 void DecodeComplete(scoped_ptr<I420VideoFrame> frame,
34 const base::TimeTicks render_time) { 34 const base::TimeTicks render_time) {
35 num_called_++; 35 num_called_++;
36 } 36 }
37 37
38 int number_times_called() {return num_called_;} 38 int number_times_called() {return num_called_;}
39
40 protected:
41 virtual ~TestVideoDecoderCallback() {}
42
43 private: 39 private:
44 friend class base::RefCountedThreadSafe<TestVideoDecoderCallback>;
45
46 int num_called_; 40 int num_called_;
47 }; 41 };
48 42
49 class VideoDecoderTest : public ::testing::Test { 43 class VideoDecoderTest : public ::testing::Test {
50 protected: 44 protected:
51 VideoDecoderTest() { 45 VideoDecoderTest() {
52 // Configure to vp8. 46 // Configure to vp8.
53 config_.codec = kVp8; 47 config_.codec = kVp8;
54 config_.use_external_decoder = false; 48 config_.use_external_decoder = false;
55 video_decoder_callback_ = new TestVideoDecoderCallback(); 49 video_decoder_callback_ = new TestVideoDecoderCallback();
56 } 50 }
57 51
58 virtual ~VideoDecoderTest() {} 52 ~VideoDecoderTest() {}
59 virtual void SetUp() { 53 virtual void SetUp() {
60 task_runner_ = new test::FakeTaskRunner(&testing_clock_); 54 task_runner_ = new test::FakeTaskRunner(&testing_clock_);
61 cast_thread_ = new CastThread(task_runner_, NULL, NULL, 55 cast_thread_ = new CastThread(task_runner_, NULL, NULL,
62 NULL, task_runner_); 56 NULL, task_runner_);
63 decoder_ = new VideoDecoder(cast_thread_, config_); 57 decoder_ = new VideoDecoder(cast_thread_, config_);
64 } 58 }
65 59
66 scoped_refptr<VideoDecoder> decoder_; 60 scoped_refptr<VideoDecoder> decoder_;
67 VideoReceiverConfig config_; 61 VideoReceiverConfig config_;
68 EncodedVideoFrame encoded_frame_; 62 EncodedVideoFrame encoded_frame_;
(...skipping 22 matching lines...) Expand all
91 video_decoder_callback_.get()); 85 video_decoder_callback_.get());
92 encoded_frame_.data.assign(kFrameSize, 0); 86 encoded_frame_.data.assign(kFrameSize, 0);
93 encoded_frame_.codec = kExternalVideo; 87 encoded_frame_.codec = kExternalVideo;
94 EXPECT_DEATH(decoder_->DecodeVideoFrame(&encoded_frame_, render_time, 88 EXPECT_DEATH(decoder_->DecodeVideoFrame(&encoded_frame_, render_time,
95 frame_decoded_callback, base::Bind(ReleaseFrame, &encoded_frame_)), 89 frame_decoded_callback, base::Bind(ReleaseFrame, &encoded_frame_)),
96 "Invalid codec"); 90 "Invalid codec");
97 } 91 }
98 92
99 } // namespace cast 93 } // namespace cast
100 } // namespace media 94 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/cast/video_receiver/video_decoder.h ('k') | trunk/src/media/cast/video_receiver/video_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698