OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 cricket::VideoRenderer* renderer)); | 92 cricket::VideoRenderer* renderer)); |
93 MOCK_METHOD3(SetVideoSend, | 93 MOCK_METHOD3(SetVideoSend, |
94 void(uint32_t ssrc, | 94 void(uint32_t ssrc, |
95 bool enable, | 95 bool enable, |
96 const cricket::VideoOptions* options)); | 96 const cricket::VideoOptions* options)); |
97 }; | 97 }; |
98 | 98 |
99 class FakeVideoSource : public Notifier<VideoSourceInterface> { | 99 class FakeVideoSource : public Notifier<VideoSourceInterface> { |
100 public: | 100 public: |
101 static rtc::scoped_refptr<FakeVideoSource> Create() { | 101 static rtc::scoped_refptr<FakeVideoSource> Create() { |
102 return new rtc::RefCountedObject<FakeVideoSource>(); | 102 return new rtc::RefCountedObject<FakeVideoSource>(false); |
103 } | 103 } |
104 virtual cricket::VideoCapturer* GetVideoCapturer() { return &fake_capturer_; } | 104 virtual cricket::VideoCapturer* GetVideoCapturer() { return &fake_capturer_; } |
105 virtual void Stop() {} | 105 virtual void Stop() {} |
106 virtual void Restart() {} | 106 virtual void Restart() {} |
107 virtual void AddSink(cricket::VideoRenderer* output) {} | 107 virtual void AddSink(cricket::VideoRenderer* output) {} |
108 virtual void RemoveSink(cricket::VideoRenderer* output) {} | 108 virtual void RemoveSink(cricket::VideoRenderer* output) {} |
109 virtual SourceState state() const { return state_; } | 109 virtual SourceState state() const { return state_; } |
| 110 virtual bool remote() const { return remote_; } |
110 virtual const cricket::VideoOptions* options() const { return &options_; } | 111 virtual const cricket::VideoOptions* options() const { return &options_; } |
111 virtual cricket::VideoRenderer* FrameInput() { return NULL; } | 112 virtual cricket::VideoRenderer* FrameInput() { return NULL; } |
112 | 113 |
113 protected: | 114 protected: |
114 FakeVideoSource() : state_(kLive) {} | 115 explicit FakeVideoSource(bool remote) : state_(kLive), remote_(remote) {} |
115 ~FakeVideoSource() {} | 116 ~FakeVideoSource() {} |
116 | 117 |
117 private: | 118 private: |
118 cricket::FakeVideoCapturer fake_capturer_; | 119 cricket::FakeVideoCapturer fake_capturer_; |
119 SourceState state_; | 120 SourceState state_; |
| 121 bool remote_; |
120 cricket::VideoOptions options_; | 122 cricket::VideoOptions options_; |
121 }; | 123 }; |
122 | 124 |
123 class RtpSenderReceiverTest : public testing::Test { | 125 class RtpSenderReceiverTest : public testing::Test { |
124 public: | 126 public: |
125 virtual void SetUp() { | 127 virtual void SetUp() { |
126 stream_ = MediaStream::Create(kStreamLabel1); | 128 stream_ = MediaStream::Create(kStreamLabel1); |
127 rtc::scoped_refptr<VideoSourceInterface> source(FakeVideoSource::Create()); | 129 rtc::scoped_refptr<VideoSourceInterface> source(FakeVideoSource::Create()); |
128 video_track_ = VideoTrack::Create(kVideoTrackId, source); | 130 video_track_ = VideoTrack::Create(kVideoTrackId, source); |
129 EXPECT_TRUE(stream_->AddTrack(video_track_)); | 131 EXPECT_TRUE(stream_->AddTrack(video_track_)); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 video_track_->GetSource()->GetVideoCapturer())); | 494 video_track_->GetSource()->GetVideoCapturer())); |
493 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); | 495 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); |
494 sender->SetSsrc(kVideoSsrc2); | 496 sender->SetSsrc(kVideoSsrc2); |
495 | 497 |
496 // Calls expected from destructor. | 498 // Calls expected from destructor. |
497 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); | 499 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); |
498 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); | 500 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); |
499 } | 501 } |
500 | 502 |
501 } // namespace webrtc | 503 } // namespace webrtc |
OLD | NEW |