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/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_environment.h" | 10 #include "media/cast/cast_environment.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 TestVideoReceiverCallback() | 29 TestVideoReceiverCallback() |
30 : num_called_(0) {} | 30 : num_called_(0) {} |
31 | 31 |
32 // TODO(mikhal): Set and check expectations. | 32 // TODO(mikhal): Set and check expectations. |
33 void DecodeComplete(const scoped_refptr<media::VideoFrame>& video_frame, | 33 void DecodeComplete(const scoped_refptr<media::VideoFrame>& video_frame, |
34 const base::TimeTicks& render_time) { | 34 const base::TimeTicks& render_time) { |
35 ++num_called_; | 35 ++num_called_; |
36 } | 36 } |
37 | 37 |
38 void FrameToDecode(scoped_ptr<transport::EncodedVideoFrame> video_frame, | 38 void FrameToDecode(scoped_ptr<EncodedVideoFrame> video_frame, |
39 const base::TimeTicks& render_time) { | 39 const base::TimeTicks& render_time) { |
40 EXPECT_TRUE(video_frame->key_frame); | 40 EXPECT_TRUE(video_frame->key_frame); |
41 EXPECT_EQ(transport::kVp8, video_frame->codec); | 41 EXPECT_EQ(kVp8, video_frame->codec); |
42 ++num_called_; | 42 ++num_called_; |
43 } | 43 } |
44 | 44 |
45 int number_times_called() const { return num_called_;} | 45 int number_times_called() const { return num_called_;} |
46 | 46 |
47 protected: | 47 protected: |
48 virtual ~TestVideoReceiverCallback() {} | 48 virtual ~TestVideoReceiverCallback() {} |
49 | 49 |
50 private: | 50 private: |
51 friend class base::RefCountedThreadSafe<TestVideoReceiverCallback>; | 51 friend class base::RefCountedThreadSafe<TestVideoReceiverCallback>; |
(...skipping 10 matching lines...) Expand all Loading... |
62 : VideoReceiver(cast_environment, video_config, packet_sender) { | 62 : VideoReceiver(cast_environment, video_config, packet_sender) { |
63 } | 63 } |
64 using VideoReceiver::IncomingParsedRtpPacket; | 64 using VideoReceiver::IncomingParsedRtpPacket; |
65 }; | 65 }; |
66 | 66 |
67 | 67 |
68 class VideoReceiverTest : public ::testing::Test { | 68 class VideoReceiverTest : public ::testing::Test { |
69 protected: | 69 protected: |
70 VideoReceiverTest() { | 70 VideoReceiverTest() { |
71 // Configure to use vp8 software implementation. | 71 // Configure to use vp8 software implementation. |
72 config_.codec = transport::kVp8; | 72 config_.codec = kVp8; |
73 config_.use_external_decoder = false; | 73 config_.use_external_decoder = false; |
74 task_runner_ = new test::FakeTaskRunner(&testing_clock_); | 74 task_runner_ = new test::FakeTaskRunner(&testing_clock_); |
75 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, | 75 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, |
76 task_runner_, task_runner_, task_runner_, task_runner_, | 76 task_runner_, task_runner_, task_runner_, task_runner_, |
77 task_runner_, GetDefaultCastLoggingConfig()); | 77 GetDefaultCastLoggingConfig()); |
78 receiver_.reset(new | 78 receiver_.reset(new |
79 PeerVideoReceiver(cast_environment_, config_, &mock_transport_)); | 79 PeerVideoReceiver(cast_environment_, config_, &mock_transport_)); |
80 testing_clock_.Advance( | 80 testing_clock_.Advance( |
81 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 81 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
82 video_receiver_callback_ = new TestVideoReceiverCallback(); | 82 video_receiver_callback_ = new TestVideoReceiverCallback(); |
83 } | 83 } |
84 | 84 |
85 virtual ~VideoReceiverTest() {} | 85 virtual ~VideoReceiverTest() {} |
86 | 86 |
87 virtual void SetUp() { | 87 virtual void SetUp() { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 task_runner_->RunTasks(); | 160 task_runner_->RunTasks(); |
161 EXPECT_EQ(video_receiver_callback_->number_times_called(), 0); | 161 EXPECT_EQ(video_receiver_callback_->number_times_called(), 0); |
162 } | 162 } |
163 | 163 |
164 // TODO(pwestin): add encoded frames. | 164 // TODO(pwestin): add encoded frames. |
165 | 165 |
166 } // namespace cast | 166 } // namespace cast |
167 } // namespace media | 167 } // namespace media |
168 | 168 |
169 | 169 |
OLD | NEW |