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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 EXPECT_FALSE(stream_->AddTrack(audio_track_)); | 73 EXPECT_FALSE(stream_->AddTrack(audio_track_)); |
74 } | 74 } |
75 | 75 |
76 void ChangeTrack(MediaStreamTrackInterface* track) { | 76 void ChangeTrack(MediaStreamTrackInterface* track) { |
77 MockObserver observer(track); | 77 MockObserver observer(track); |
78 | 78 |
79 EXPECT_CALL(observer, OnChanged()) | 79 EXPECT_CALL(observer, OnChanged()) |
80 .Times(Exactly(1)); | 80 .Times(Exactly(1)); |
81 track->set_enabled(false); | 81 track->set_enabled(false); |
82 EXPECT_FALSE(track->enabled()); | 82 EXPECT_FALSE(track->enabled()); |
83 | |
84 EXPECT_EQ(MediaStreamTrackInterface::kLive, track->state()); | |
85 EXPECT_CALL(observer, OnChanged()) | |
86 .Times(Exactly(1)); | |
87 track->set_state(MediaStreamTrackInterface::kEnded); | |
88 EXPECT_EQ(MediaStreamTrackInterface::kEnded, track->state()); | |
89 } | 83 } |
90 | 84 |
91 scoped_refptr<MediaStreamInterface> stream_; | 85 scoped_refptr<MediaStreamInterface> stream_; |
92 scoped_refptr<AudioTrackInterface> audio_track_; | 86 scoped_refptr<AudioTrackInterface> audio_track_; |
93 scoped_refptr<VideoTrackInterface> video_track_; | 87 scoped_refptr<VideoTrackInterface> video_track_; |
94 }; | 88 }; |
95 | 89 |
96 TEST_F(MediaStreamTest, GetTrackInfo) { | 90 TEST_F(MediaStreamTest, GetTrackInfo) { |
97 ASSERT_EQ(1u, stream_->GetVideoTracks().size()); | 91 ASSERT_EQ(1u, stream_->GetVideoTracks().size()); |
98 ASSERT_EQ(1u, stream_->GetAudioTracks().size()); | 92 ASSERT_EQ(1u, stream_->GetAudioTracks().size()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ChangeTrack(video_track.get()); | 146 ChangeTrack(video_track.get()); |
153 } | 147 } |
154 | 148 |
155 TEST_F(MediaStreamTest, ChangeAudioTrack) { | 149 TEST_F(MediaStreamTest, ChangeAudioTrack) { |
156 scoped_refptr<webrtc::AudioTrackInterface> audio_track( | 150 scoped_refptr<webrtc::AudioTrackInterface> audio_track( |
157 stream_->GetAudioTracks()[0]); | 151 stream_->GetAudioTracks()[0]); |
158 ChangeTrack(audio_track.get()); | 152 ChangeTrack(audio_track.get()); |
159 } | 153 } |
160 | 154 |
161 } // namespace webrtc | 155 } // namespace webrtc |
OLD | NEW |