OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 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 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 | 2120 |
2121 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, | 2121 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, |
2122 cricket::kFakeDefaultDeviceId); | 2122 cricket::kFakeDefaultDeviceId); |
2123 cricket::Device dev(cricket::kFakeDeviceName, | 2123 cricket::Device dev(cricket::kFakeDeviceName, |
2124 cricket::kFakeDeviceId); | 2124 cricket::kFakeDeviceId); |
2125 | 2125 |
2126 // Test SetDevices() while not sending or playing. | 2126 // Test SetDevices() while not sending or playing. |
2127 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); | 2127 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); |
2128 | 2128 |
2129 // Test SetDevices() while sending and playing. | 2129 // Test SetDevices() while sending and playing. |
2130 EXPECT_TRUE(engine_.SetLocalMonitor(true)); | |
2131 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); | 2130 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); |
2132 EXPECT_TRUE(channel_->SetPlayout(true)); | 2131 EXPECT_TRUE(channel_->SetPlayout(true)); |
2133 EXPECT_TRUE(voe_.GetRecordingMicrophone()); | |
2134 EXPECT_TRUE(voe_.GetSend(channel_num)); | 2132 EXPECT_TRUE(voe_.GetSend(channel_num)); |
2135 EXPECT_TRUE(voe_.GetPlayout(channel_num)); | 2133 EXPECT_TRUE(voe_.GetPlayout(channel_num)); |
2136 | 2134 |
2137 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | 2135 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); |
2138 | 2136 |
2139 EXPECT_TRUE(voe_.GetRecordingMicrophone()); | |
2140 EXPECT_TRUE(voe_.GetSend(channel_num)); | 2137 EXPECT_TRUE(voe_.GetSend(channel_num)); |
2141 EXPECT_TRUE(voe_.GetPlayout(channel_num)); | 2138 EXPECT_TRUE(voe_.GetPlayout(channel_num)); |
2142 | 2139 |
2143 // Test that failure to open newly selected devices does not prevent opening | 2140 // Test that failure to open newly selected devices does not prevent opening |
2144 // ones after that. | 2141 // ones after that. |
2145 voe_.set_fail_start_recording_microphone(true); | |
2146 voe_.set_playout_fail_channel(channel_num); | 2142 voe_.set_playout_fail_channel(channel_num); |
2147 voe_.set_send_fail_channel(channel_num); | 2143 voe_.set_send_fail_channel(channel_num); |
2148 | 2144 |
2149 EXPECT_FALSE(engine_.SetDevices(&default_dev, &default_dev)); | 2145 EXPECT_FALSE(engine_.SetDevices(&default_dev, &default_dev)); |
2150 | 2146 |
2151 EXPECT_FALSE(voe_.GetRecordingMicrophone()); | |
2152 EXPECT_FALSE(voe_.GetSend(channel_num)); | 2147 EXPECT_FALSE(voe_.GetSend(channel_num)); |
2153 EXPECT_FALSE(voe_.GetPlayout(channel_num)); | 2148 EXPECT_FALSE(voe_.GetPlayout(channel_num)); |
2154 | 2149 |
2155 voe_.set_fail_start_recording_microphone(false); | |
2156 voe_.set_playout_fail_channel(-1); | 2150 voe_.set_playout_fail_channel(-1); |
2157 voe_.set_send_fail_channel(-1); | 2151 voe_.set_send_fail_channel(-1); |
2158 | 2152 |
2159 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | 2153 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); |
2160 | 2154 |
2161 EXPECT_TRUE(voe_.GetRecordingMicrophone()); | |
2162 EXPECT_TRUE(voe_.GetSend(channel_num)); | 2155 EXPECT_TRUE(voe_.GetSend(channel_num)); |
2163 EXPECT_TRUE(voe_.GetPlayout(channel_num)); | 2156 EXPECT_TRUE(voe_.GetPlayout(channel_num)); |
2164 } | 2157 } |
2165 | 2158 |
2166 // Test that we can set the devices to use even if we failed to | 2159 // Test that we can set the devices to use even if we failed to |
2167 // open the initial ones. | 2160 // open the initial ones. |
2168 TEST_F(WebRtcVoiceEngineTestFake, SetDevicesWithInitiallyBadDevices) { | 2161 TEST_F(WebRtcVoiceEngineTestFake, SetDevicesWithInitiallyBadDevices) { |
2169 EXPECT_TRUE(SetupEngine()); | 2162 EXPECT_TRUE(SetupEngine()); |
2170 int channel_num = voe_.GetLastChannel(); | 2163 int channel_num = voe_.GetLastChannel(); |
2171 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2164 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2172 | 2165 |
2173 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, | 2166 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, |
2174 cricket::kFakeDefaultDeviceId); | 2167 cricket::kFakeDefaultDeviceId); |
2175 cricket::Device dev(cricket::kFakeDeviceName, | 2168 cricket::Device dev(cricket::kFakeDeviceName, |
2176 cricket::kFakeDeviceId); | 2169 cricket::kFakeDeviceId); |
2177 | 2170 |
2178 // Test that failure to open devices selected before starting | 2171 // Test that failure to open devices selected before starting |
2179 // send/play does not prevent opening newly selected ones after that. | 2172 // send/play does not prevent opening newly selected ones after that. |
2180 voe_.set_fail_start_recording_microphone(true); | |
2181 voe_.set_playout_fail_channel(channel_num); | 2173 voe_.set_playout_fail_channel(channel_num); |
2182 voe_.set_send_fail_channel(channel_num); | 2174 voe_.set_send_fail_channel(channel_num); |
2183 | 2175 |
2184 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); | 2176 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); |
2185 | 2177 |
2186 EXPECT_FALSE(engine_.SetLocalMonitor(true)); | |
2187 EXPECT_FALSE(channel_->SetSend(cricket::SEND_MICROPHONE)); | 2178 EXPECT_FALSE(channel_->SetSend(cricket::SEND_MICROPHONE)); |
2188 EXPECT_FALSE(channel_->SetPlayout(true)); | 2179 EXPECT_FALSE(channel_->SetPlayout(true)); |
2189 EXPECT_FALSE(voe_.GetRecordingMicrophone()); | |
2190 EXPECT_FALSE(voe_.GetSend(channel_num)); | 2180 EXPECT_FALSE(voe_.GetSend(channel_num)); |
2191 EXPECT_FALSE(voe_.GetPlayout(channel_num)); | 2181 EXPECT_FALSE(voe_.GetPlayout(channel_num)); |
2192 | 2182 |
2193 voe_.set_fail_start_recording_microphone(false); | |
2194 voe_.set_playout_fail_channel(-1); | 2183 voe_.set_playout_fail_channel(-1); |
2195 voe_.set_send_fail_channel(-1); | 2184 voe_.set_send_fail_channel(-1); |
2196 | 2185 |
2197 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | 2186 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); |
2198 | 2187 |
2199 EXPECT_TRUE(voe_.GetRecordingMicrophone()); | |
2200 EXPECT_TRUE(voe_.GetSend(channel_num)); | 2188 EXPECT_TRUE(voe_.GetSend(channel_num)); |
2201 EXPECT_TRUE(voe_.GetPlayout(channel_num)); | 2189 EXPECT_TRUE(voe_.GetPlayout(channel_num)); |
2202 } | 2190 } |
2203 | 2191 |
2204 // Test that we can create a channel configured for multi-point conferences, | 2192 // Test that we can create a channel configured for multi-point conferences, |
2205 // and start sending/playing out on it. | 2193 // and start sending/playing out on it. |
2206 TEST_F(WebRtcVoiceEngineTestFake, ConferenceSendAndPlayout) { | 2194 TEST_F(WebRtcVoiceEngineTestFake, ConferenceSendAndPlayout) { |
2207 EXPECT_TRUE(SetupEngine()); | 2195 EXPECT_TRUE(SetupEngine()); |
2208 int channel_num = voe_.GetLastChannel(); | 2196 int channel_num = voe_.GetLastChannel(); |
2209 send_parameters_.options = options_conference_; | 2197 send_parameters_.options = options_conference_; |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3468 cricket::WebRtcVoiceEngine engine; | 3456 cricket::WebRtcVoiceEngine engine; |
3469 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3457 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3470 rtc::scoped_ptr<webrtc::Call> call( | 3458 rtc::scoped_ptr<webrtc::Call> call( |
3471 webrtc::Call::Create(webrtc::Call::Config())); | 3459 webrtc::Call::Create(webrtc::Call::Config())); |
3472 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3460 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
3473 call.get()); | 3461 call.get()); |
3474 cricket::AudioRecvParameters parameters; | 3462 cricket::AudioRecvParameters parameters; |
3475 parameters.codecs = engine.codecs(); | 3463 parameters.codecs = engine.codecs(); |
3476 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3464 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3477 } | 3465 } |
OLD | NEW |