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(); |
| 205 |
| 206 // Check if the file has been created. |
| 207 FILE* event_file = fopen(temp_filename.c_str(), "r"); |
| 208 ASSERT_TRUE(event_file); |
| 209 fclose(event_file); |
| 210 // Remove the temporary file. |
| 211 remove(temp_filename.c_str()); |
| 212 } |
| 213 #endif // ENABLE_RTC_EVENT_LOG |
| 214 |
185 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. | 215 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. |
186 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { | 216 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { |
187 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 217 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
188 voe_codec_->GetCodec(i, codec_instance_); | 218 voe_codec_->GetCodec(i, codec_instance_); |
189 if (IsNotViableSendCodec(codec_instance_.plname)) { | 219 if (IsNotViableSendCodec(codec_instance_.plname)) { |
190 TEST_LOG("Skipping %s.\n", codec_instance_.plname); | 220 TEST_LOG("Skipping %s.\n", codec_instance_.plname); |
191 continue; | 221 continue; |
192 } | 222 } |
193 EXPECT_NE(-1, codec_instance_.pltype) << | 223 EXPECT_NE(-1, codec_instance_.pltype) << |
194 "The codec database should suggest a payload type."; | 224 "The codec database should suggest a payload type."; |
(...skipping 17 matching lines...) Expand all Loading... |
212 TEST_LOG("%d ", packet_size); | 242 TEST_LOG("%d ", packet_size); |
213 TEST_LOG_FLUSH; | 243 TEST_LOG_FLUSH; |
214 at_least_one_succeeded = true; | 244 at_least_one_succeeded = true; |
215 Sleep(CODEC_TEST_TIME); | 245 Sleep(CODEC_TEST_TIME); |
216 } | 246 } |
217 } | 247 } |
218 TEST_LOG("\n"); | 248 TEST_LOG("\n"); |
219 EXPECT_TRUE(at_least_one_succeeded); | 249 EXPECT_TRUE(at_least_one_succeeded); |
220 } | 250 } |
221 } | 251 } |
OLD | NEW |