OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 <stdio.h> | |
12 #include <string> | |
13 | |
14 #include "webrtc/test/test_suite.h" | |
15 #include "webrtc/test/testsupport/fileutils.h" | |
11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" | 16 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" |
12 #include "webrtc/voice_engine/voice_engine_defines.h" | 17 #include "webrtc/voice_engine/voice_engine_defines.h" |
18 #include "webrtc/video/rtc_event_log.h" | |
13 | 19 |
14 class CodecTest : public AfterStreamingFixture { | 20 class CodecTest : public AfterStreamingFixture { |
15 protected: | 21 protected: |
16 void SetUp() { | 22 void SetUp() { |
17 memset(&codec_instance_, 0, sizeof(codec_instance_)); | 23 memset(&codec_instance_, 0, sizeof(codec_instance_)); |
18 } | 24 } |
19 | 25 |
20 void SetArbitrarySendCodec() { | 26 void SetArbitrarySendCodec() { |
21 // Just grab the first codec. | 27 // Just grab the first codec. |
22 EXPECT_EQ(0, voe_codec_->GetCodec(0, codec_instance_)); | 28 EXPECT_EQ(0, voe_codec_->GetCodec(0, codec_instance_)); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 voe_codec_->GetCodec(i, codec_instance_); | 181 voe_codec_->GetCodec(i, codec_instance_); |
176 if (!_stricmp("opus", codec_instance_.plname)) { | 182 if (!_stricmp("opus", codec_instance_.plname)) { |
177 continue; | 183 continue; |
178 } | 184 } |
179 voe_codec_->SetSendCodec(channel_, codec_instance_); | 185 voe_codec_->SetSendCodec(channel_, codec_instance_); |
180 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, false)); | 186 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, false)); |
181 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); | 187 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); |
182 } | 188 } |
183 } | 189 } |
184 | 190 |
191 #ifdef ENABLE_RTC_EVENT_LOG | |
192 TEST_F(CodecTest, RtcEventLogIntegrationTest) { | |
193 webrtc::RtcEventLog* event_log = voe_codec_->GetEventLog(); | |
194 ASSERT_TRUE(event_log); | |
195 | |
196 // Find the name of the current test, in order to use it as a temporary | |
197 // filename. | |
198 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); | |
199 const std::string temp_filename = webrtc::test::OutputPath() + | |
200 test_info->test_case_name() + | |
201 test_info->name(); | |
202 // Create a log file. | |
203 event_log->StartLogging(temp_filename, 1000); | |
204 event_log->StopLogging(); | |
Henrik Grunell WebRTC
2015/08/24 09:03:03
Is there maybe any VoE function call that should r
ivoc
2015/08/24 12:17:29
There are currently no functions on the VoE API th
Henrik Grunell WebRTC
2015/08/24 12:23:34
If there's other tests that covers those I'm fine
| |
205 | |
206 // Check if the file has been created. | |
207 FILE* event_file = fopen(temp_filename.c_str(), "r"); | |
208 EXPECT_TRUE(event_file); | |
Henrik Grunell WebRTC
2015/08/24 09:03:02
I think you can just assert here, if it couldn't b
ivoc
2015/08/24 12:17:29
Done.
| |
209 if (event_file) { | |
210 fclose(event_file); | |
211 // Remove the temporary file. | |
212 remove(temp_filename.c_str()); | |
213 } | |
214 } | |
215 #endif // ENABLE_RTC_EVENT_LOG | |
216 | |
185 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. | 217 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. |
186 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { | 218 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { |
187 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 219 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
188 voe_codec_->GetCodec(i, codec_instance_); | 220 voe_codec_->GetCodec(i, codec_instance_); |
189 if (IsNotViableSendCodec(codec_instance_.plname)) { | 221 if (IsNotViableSendCodec(codec_instance_.plname)) { |
190 TEST_LOG("Skipping %s.\n", codec_instance_.plname); | 222 TEST_LOG("Skipping %s.\n", codec_instance_.plname); |
191 continue; | 223 continue; |
192 } | 224 } |
193 EXPECT_NE(-1, codec_instance_.pltype) << | 225 EXPECT_NE(-1, codec_instance_.pltype) << |
194 "The codec database should suggest a payload type."; | 226 "The codec database should suggest a payload type."; |
(...skipping 17 matching lines...) Expand all Loading... | |
212 TEST_LOG("%d ", packet_size); | 244 TEST_LOG("%d ", packet_size); |
213 TEST_LOG_FLUSH; | 245 TEST_LOG_FLUSH; |
214 at_least_one_succeeded = true; | 246 at_least_one_succeeded = true; |
215 Sleep(CODEC_TEST_TIME); | 247 Sleep(CODEC_TEST_TIME); |
216 } | 248 } |
217 } | 249 } |
218 TEST_LOG("\n"); | 250 TEST_LOG("\n"); |
219 EXPECT_TRUE(at_least_one_succeeded); | 251 EXPECT_TRUE(at_least_one_succeeded); |
220 } | 252 } |
221 } | 253 } |
OLD | NEW |