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 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "webrtc/api/audiotrack.h" | 13 #include "webrtc/api/audiotrack.h" |
14 #include "webrtc/api/mediastream.h" | 14 #include "webrtc/api/mediastream.h" |
15 #include "webrtc/api/videotrack.h" | 15 #include "webrtc/api/videotrack.h" |
| 16 #include "webrtc/api/test/fakevideotracksource.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "webrtc/base/gunit.h" | 19 #include "webrtc/base/gunit.h" |
19 #include "webrtc/base/refcount.h" | 20 #include "webrtc/base/refcount.h" |
20 #include "webrtc/base/scoped_ptr.h" | 21 #include "webrtc/base/scoped_ptr.h" |
21 | 22 |
22 static const char kStreamLabel1[] = "local_stream_1"; | 23 static const char kStreamLabel1[] = "local_stream_1"; |
23 static const char kVideoTrackId[] = "dummy_video_cam_1"; | 24 static const char kVideoTrackId[] = "dummy_video_cam_1"; |
24 static const char kAudioTrackId[] = "dummy_microphone_1"; | 25 static const char kAudioTrackId[] = "dummy_microphone_1"; |
25 | 26 |
(...skipping 23 matching lines...) Expand all Loading... |
49 private: | 50 private: |
50 NotifierInterface* notifier_; | 51 NotifierInterface* notifier_; |
51 }; | 52 }; |
52 | 53 |
53 class MediaStreamTest: public testing::Test { | 54 class MediaStreamTest: public testing::Test { |
54 protected: | 55 protected: |
55 virtual void SetUp() { | 56 virtual void SetUp() { |
56 stream_ = MediaStream::Create(kStreamLabel1); | 57 stream_ = MediaStream::Create(kStreamLabel1); |
57 ASSERT_TRUE(stream_.get() != NULL); | 58 ASSERT_TRUE(stream_.get() != NULL); |
58 | 59 |
59 video_track_ = VideoTrack::Create(kVideoTrackId, NULL); | 60 video_track_ = |
| 61 VideoTrack::Create(kVideoTrackId, FakeVideoTrackSource::Create()); |
60 ASSERT_TRUE(video_track_.get() != NULL); | 62 ASSERT_TRUE(video_track_.get() != NULL); |
61 EXPECT_EQ(MediaStreamTrackInterface::kInitializing, video_track_->state()); | 63 EXPECT_EQ(MediaStreamTrackInterface::kInitializing, video_track_->state()); |
62 | 64 |
63 audio_track_ = AudioTrack::Create(kAudioTrackId, NULL); | 65 audio_track_ = AudioTrack::Create(kAudioTrackId, NULL); |
64 | 66 |
65 ASSERT_TRUE(audio_track_.get() != NULL); | 67 ASSERT_TRUE(audio_track_.get() != NULL); |
66 EXPECT_EQ(MediaStreamTrackInterface::kInitializing, audio_track_->state()); | 68 EXPECT_EQ(MediaStreamTrackInterface::kInitializing, audio_track_->state()); |
67 | 69 |
68 EXPECT_TRUE(stream_->AddTrack(video_track_)); | 70 EXPECT_TRUE(stream_->AddTrack(video_track_)); |
69 EXPECT_FALSE(stream_->AddTrack(video_track_)); | 71 EXPECT_FALSE(stream_->AddTrack(video_track_)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ChangeTrack(video_track.get()); | 151 ChangeTrack(video_track.get()); |
150 } | 152 } |
151 | 153 |
152 TEST_F(MediaStreamTest, ChangeAudioTrack) { | 154 TEST_F(MediaStreamTest, ChangeAudioTrack) { |
153 scoped_refptr<webrtc::AudioTrackInterface> audio_track( | 155 scoped_refptr<webrtc::AudioTrackInterface> audio_track( |
154 stream_->GetAudioTracks()[0]); | 156 stream_->GetAudioTracks()[0]); |
155 ChangeTrack(audio_track.get()); | 157 ChangeTrack(audio_track.get()); |
156 } | 158 } |
157 | 159 |
158 } // namespace webrtc | 160 } // namespace webrtc |
OLD | NEW |