OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 MOCK_METHOD0(OnChanged, void()); | 47 MOCK_METHOD0(OnChanged, void()); |
48 | 48 |
49 private: | 49 private: |
50 NotifierInterface* notifier_; | 50 NotifierInterface* notifier_; |
51 }; | 51 }; |
52 | 52 |
53 class MediaStreamTest: public testing::Test { | 53 class MediaStreamTest: public testing::Test { |
54 protected: | 54 protected: |
55 virtual void SetUp() { | 55 virtual void SetUp() { |
56 stream_ = MediaStream::Create(kStreamLabel1); | 56 stream_ = MediaStream::Create(kStreamLabel1); |
57 ASSERT_TRUE(stream_.get() != NULL); | 57 ASSERT_TRUE(stream_.get() != nullptr); |
58 | 58 |
59 video_track_ = | 59 video_track_ = |
60 VideoTrack::Create(kVideoTrackId, FakeVideoTrackSource::Create()); | 60 VideoTrack::Create(kVideoTrackId, FakeVideoTrackSource::Create()); |
61 ASSERT_TRUE(video_track_.get() != NULL); | 61 ASSERT_TRUE(video_track_.get() != nullptr); |
62 EXPECT_EQ(MediaStreamTrackInterface::kLive, video_track_->state()); | 62 EXPECT_EQ(MediaStreamTrackInterface::kLive, video_track_->state()); |
63 | 63 |
64 audio_track_ = AudioTrack::Create(kAudioTrackId, NULL); | 64 audio_track_ = AudioTrack::Create(kAudioTrackId, nullptr); |
65 | 65 |
66 ASSERT_TRUE(audio_track_.get() != NULL); | 66 ASSERT_TRUE(audio_track_.get() != nullptr); |
67 EXPECT_EQ(MediaStreamTrackInterface::kLive, audio_track_->state()); | 67 EXPECT_EQ(MediaStreamTrackInterface::kLive, audio_track_->state()); |
68 | 68 |
69 EXPECT_TRUE(stream_->AddTrack(video_track_)); | 69 EXPECT_TRUE(stream_->AddTrack(video_track_)); |
70 EXPECT_FALSE(stream_->AddTrack(video_track_)); | 70 EXPECT_FALSE(stream_->AddTrack(video_track_)); |
71 EXPECT_TRUE(stream_->AddTrack(audio_track_)); | 71 EXPECT_TRUE(stream_->AddTrack(audio_track_)); |
72 EXPECT_FALSE(stream_->AddTrack(audio_track_)); | 72 EXPECT_FALSE(stream_->AddTrack(audio_track_)); |
73 } | 73 } |
74 | 74 |
75 void ChangeTrack(MediaStreamTrackInterface* track) { | 75 void ChangeTrack(MediaStreamTrackInterface* track) { |
76 MockObserver observer(track); | 76 MockObserver observer(track); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 EXPECT_FALSE(stream_->RemoveTrack(audio_track_)); | 128 EXPECT_FALSE(stream_->RemoveTrack(audio_track_)); |
129 EXPECT_EQ(0u, stream_->GetAudioTracks().size()); | 129 EXPECT_EQ(0u, stream_->GetAudioTracks().size()); |
130 EXPECT_EQ(0u, stream_->GetAudioTracks().size()); | 130 EXPECT_EQ(0u, stream_->GetAudioTracks().size()); |
131 | 131 |
132 EXPECT_TRUE(stream_->RemoveTrack(video_track_)); | 132 EXPECT_TRUE(stream_->RemoveTrack(video_track_)); |
133 EXPECT_FALSE(stream_->RemoveTrack(video_track_)); | 133 EXPECT_FALSE(stream_->RemoveTrack(video_track_)); |
134 | 134 |
135 EXPECT_EQ(0u, stream_->GetVideoTracks().size()); | 135 EXPECT_EQ(0u, stream_->GetVideoTracks().size()); |
136 EXPECT_EQ(0u, stream_->GetVideoTracks().size()); | 136 EXPECT_EQ(0u, stream_->GetVideoTracks().size()); |
137 | 137 |
138 EXPECT_FALSE(stream_->RemoveTrack(static_cast<AudioTrackInterface*>(NULL))); | 138 EXPECT_FALSE( |
139 EXPECT_FALSE(stream_->RemoveTrack(static_cast<VideoTrackInterface*>(NULL))); | 139 stream_->RemoveTrack(static_cast<AudioTrackInterface*>(nullptr))); |
| 140 EXPECT_FALSE( |
| 141 stream_->RemoveTrack(static_cast<VideoTrackInterface*>(nullptr))); |
140 } | 142 } |
141 | 143 |
142 TEST_F(MediaStreamTest, ChangeVideoTrack) { | 144 TEST_F(MediaStreamTest, ChangeVideoTrack) { |
143 scoped_refptr<webrtc::VideoTrackInterface> video_track( | 145 scoped_refptr<webrtc::VideoTrackInterface> video_track( |
144 stream_->GetVideoTracks()[0]); | 146 stream_->GetVideoTracks()[0]); |
145 ChangeTrack(video_track.get()); | 147 ChangeTrack(video_track.get()); |
146 } | 148 } |
147 | 149 |
148 TEST_F(MediaStreamTest, ChangeAudioTrack) { | 150 TEST_F(MediaStreamTest, ChangeAudioTrack) { |
149 scoped_refptr<webrtc::AudioTrackInterface> audio_track( | 151 scoped_refptr<webrtc::AudioTrackInterface> audio_track( |
150 stream_->GetAudioTracks()[0]); | 152 stream_->GetAudioTracks()[0]); |
151 ChangeTrack(audio_track.get()); | 153 ChangeTrack(audio_track.get()); |
152 } | 154 } |
153 | 155 |
154 } // namespace webrtc | 156 } // namespace webrtc |
OLD | NEW |