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_CALL(observer, OnChanged()) | |
85 .Times(Exactly(1)); | |
86 track->set_state(MediaStreamTrackInterface::kEnded); | |
87 EXPECT_EQ(MediaStreamTrackInterface::kEnded, track->state()); | |
88 } | 83 } |
89 | 84 |
90 scoped_refptr<MediaStreamInterface> stream_; | 85 scoped_refptr<MediaStreamInterface> stream_; |
91 scoped_refptr<AudioTrackInterface> audio_track_; | 86 scoped_refptr<AudioTrackInterface> audio_track_; |
92 scoped_refptr<VideoTrackInterface> video_track_; | 87 scoped_refptr<VideoTrackInterface> video_track_; |
93 }; | 88 }; |
94 | 89 |
95 TEST_F(MediaStreamTest, GetTrackInfo) { | 90 TEST_F(MediaStreamTest, GetTrackInfo) { |
96 ASSERT_EQ(1u, stream_->GetVideoTracks().size()); | 91 ASSERT_EQ(1u, stream_->GetVideoTracks().size()); |
97 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... |
151 ChangeTrack(video_track.get()); | 146 ChangeTrack(video_track.get()); |
152 } | 147 } |
153 | 148 |
154 TEST_F(MediaStreamTest, ChangeAudioTrack) { | 149 TEST_F(MediaStreamTest, ChangeAudioTrack) { |
155 scoped_refptr<webrtc::AudioTrackInterface> audio_track( | 150 scoped_refptr<webrtc::AudioTrackInterface> audio_track( |
156 stream_->GetAudioTracks()[0]); | 151 stream_->GetAudioTracks()[0]); |
157 ChangeTrack(audio_track.get()); | 152 ChangeTrack(audio_track.get()); |
158 } | 153 } |
159 | 154 |
160 } // namespace webrtc | 155 } // namespace webrtc |
OLD | NEW |