OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 using cricket::WebRtcVideoFrame::SetRotation; | 33 using cricket::WebRtcVideoFrame::SetRotation; |
34 }; | 34 }; |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 class VideoTrackTest : public testing::Test { | 38 class VideoTrackTest : public testing::Test { |
39 public: | 39 public: |
40 VideoTrackTest() { | 40 VideoTrackTest() { |
41 static const char kVideoTrackId[] = "track_id"; | 41 static const char kVideoTrackId[] = "track_id"; |
42 | |
43 channel_manager_.reset(new cricket::ChannelManager( | |
44 new cricket::FakeMediaEngine(), rtc::Thread::Current())); | |
45 EXPECT_TRUE(channel_manager_->Init()); | |
46 video_track_ = VideoTrack::Create( | 42 video_track_ = VideoTrack::Create( |
47 kVideoTrackId, | 43 kVideoTrackId, |
48 VideoSource::Create(channel_manager_.get(), | 44 VideoSource::Create(rtc::Thread::Current(), |
49 new webrtc::RemoteVideoCapturer(), NULL, true)); | 45 new webrtc::RemoteVideoCapturer(), NULL, true)); |
50 } | 46 } |
51 | 47 |
52 protected: | 48 protected: |
53 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | |
54 rtc::scoped_refptr<VideoTrackInterface> video_track_; | 49 rtc::scoped_refptr<VideoTrackInterface> video_track_; |
55 }; | 50 }; |
56 | 51 |
57 // Test adding renderers to a video track and render to them by providing | 52 // Test adding renderers to a video track and render to them by providing |
58 // frames to the source. | 53 // frames to the source. |
59 TEST_F(VideoTrackTest, RenderVideo) { | 54 TEST_F(VideoTrackTest, RenderVideo) { |
60 // FakeVideoTrackRenderer register itself to |video_track_| | 55 // FakeVideoTrackRenderer register itself to |video_track_| |
61 rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_1( | 56 rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_1( |
62 new FakeVideoTrackRenderer(video_track_.get())); | 57 new FakeVideoTrackRenderer(video_track_.get())); |
63 | 58 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 EXPECT_EQ(100, renderer->width()); | 157 EXPECT_EQ(100, renderer->width()); |
163 EXPECT_EQ(200, renderer->height()); | 158 EXPECT_EQ(200, renderer->height()); |
164 | 159 |
165 video_track_->set_enabled(true); | 160 video_track_->set_enabled(true); |
166 renderer_input->OnFrame(frame); | 161 renderer_input->OnFrame(frame); |
167 EXPECT_EQ(3, renderer->num_rendered_frames()); | 162 EXPECT_EQ(3, renderer->num_rendered_frames()); |
168 EXPECT_FALSE(renderer->black_frame()); | 163 EXPECT_FALSE(renderer->black_frame()); |
169 EXPECT_EQ(100, renderer->width()); | 164 EXPECT_EQ(100, renderer->width()); |
170 EXPECT_EQ(200, renderer->height()); | 165 EXPECT_EQ(200, renderer->height()); |
171 } | 166 } |
OLD | NEW |