Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc

Issue 1503043003: Deletes temporary files that are generated in several ACM unittests. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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>
hlundin-webrtc 2015/12/08 10:53:55 You are including the C-header, but use the C++ st
11 #include <string.h> 12 #include <string.h>
12 #include <vector> 13 #include <vector>
13 14
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "webrtc/base/md5digest.h" 16 #include "webrtc/base/md5digest.h"
16 #include "webrtc/base/platform_thread.h" 17 #include "webrtc/base/platform_thread.h"
17 #include "webrtc/base/scoped_ptr.h" 18 #include "webrtc/base/scoped_ptr.h"
18 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" 20 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
20 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" 21 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 ASSERT_NO_FATAL_FAILURE(test.RegisterNetEqTestCodecs()); 900 ASSERT_NO_FATAL_FAILURE(test.RegisterNetEqTestCodecs());
900 for (const auto& ed : external_decoders) { 901 for (const auto& ed : external_decoders) {
901 ASSERT_EQ(0, test.RegisterExternalReceiveCodec( 902 ASSERT_EQ(0, test.RegisterExternalReceiveCodec(
902 ed.rtp_payload_type, ed.external_decoder, 903 ed.rtp_payload_type, ed.external_decoder,
903 ed.sample_rate_hz, ed.num_channels)); 904 ed.sample_rate_hz, ed.num_channels));
904 } 905 }
905 test.Run(); 906 test.Run();
906 907
907 std::string checksum_string = checksum.Finish(); 908 std::string checksum_string = checksum.Finish();
908 EXPECT_EQ(checksum_ref, checksum_string); 909 EXPECT_EQ(checksum_ref, checksum_string);
910
911 // Delete the output file.
912 std::remove(output_file_name.c_str());
909 } 913 }
910 }; 914 };
911 915
912 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \ 916 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \
913 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) 917 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
914 #define IF_ALL_CODECS(x) x 918 #define IF_ALL_CODECS(x) x
915 #else 919 #else
916 #define IF_ALL_CODECS(x) DISABLED_##x 920 #define IF_ALL_CODECS(x) DISABLED_##x
917 #endif 921 #endif
918 922
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 EXPECT_EQ(audio_checksum_ref, checksum_string); 1111 EXPECT_EQ(audio_checksum_ref, checksum_string);
1108 1112
1109 // Extract and verify the payload checksum. 1113 // Extract and verify the payload checksum.
1110 char checksum_result[rtc::Md5Digest::kSize]; 1114 char checksum_result[rtc::Md5Digest::kSize];
1111 payload_checksum_.Finish(checksum_result, rtc::Md5Digest::kSize); 1115 payload_checksum_.Finish(checksum_result, rtc::Md5Digest::kSize);
1112 checksum_string = rtc::hex_encode(checksum_result, rtc::Md5Digest::kSize); 1116 checksum_string = rtc::hex_encode(checksum_result, rtc::Md5Digest::kSize);
1113 EXPECT_EQ(payload_checksum_ref, checksum_string); 1117 EXPECT_EQ(payload_checksum_ref, checksum_string);
1114 1118
1115 // Verify number of packets produced. 1119 // Verify number of packets produced.
1116 EXPECT_EQ(expected_packets, packet_count_); 1120 EXPECT_EQ(expected_packets, packet_count_);
1121
1122 // Delete the output file.
1123 std::remove(output_file_name.c_str());
1117 } 1124 }
1118 1125
1119 // Returns a pointer to the next packet. Returns NULL if the source is 1126 // Returns a pointer to the next packet. Returns NULL if the source is
1120 // depleted (i.e., the test duration is exceeded), or if an error occurred. 1127 // depleted (i.e., the test duration is exceeded), or if an error occurred.
1121 // Inherited from test::PacketSource. 1128 // Inherited from test::PacketSource.
1122 test::Packet* NextPacket() override { 1129 test::Packet* NextPacket() override {
1123 // Get the next packet from AcmSendTest. Ownership of |packet| is 1130 // Get the next packet from AcmSendTest. Ownership of |packet| is
1124 // transferred to this method. 1131 // transferred to this method.
1125 test::Packet* packet = send_test_->NextPacket(); 1132 test::Packet* packet = send_test_->NextPacket();
1126 if (!packet) 1133 if (!packet)
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 &output, 1703 &output,
1697 output_freq_1, 1704 output_freq_1,
1698 output_freq_2, 1705 output_freq_2,
1699 toggle_period_ms, 1706 toggle_period_ms,
1700 test::AcmReceiveTestOldApi::kMonoOutput); 1707 test::AcmReceiveTestOldApi::kMonoOutput);
1701 ASSERT_NO_FATAL_FAILURE(receive_test.RegisterDefaultCodecs()); 1708 ASSERT_NO_FATAL_FAILURE(receive_test.RegisterDefaultCodecs());
1702 output_freq_2_ = output_freq_2; 1709 output_freq_2_ = output_freq_2;
1703 1710
1704 // This is where the actual test is executed. 1711 // This is where the actual test is executed.
1705 receive_test.Run(); 1712 receive_test.Run();
1713
1714 // Delete output file.
1715 std::remove(output_file_name.c_str());
1706 } 1716 }
1707 1717
1708 // Inherited from test::PacketSource. 1718 // Inherited from test::PacketSource.
1709 test::Packet* NextPacket() override { 1719 test::Packet* NextPacket() override {
1710 // Check if it is time to terminate the test. The packet source is of type 1720 // Check if it is time to terminate the test. The packet source is of type
1711 // ConstantPcmPacketSource, which is infinite, so we must end the test 1721 // ConstantPcmPacketSource, which is infinite, so we must end the test
1712 // "manually". 1722 // "manually".
1713 if (num_packets_++ > kTestNumPackets) { 1723 if (num_packets_++ > kTestNumPackets) {
1714 EXPECT_TRUE(has_toggled_); 1724 EXPECT_TRUE(has_toggled_);
1715 return NULL; // Test ended. 1725 return NULL; // Test ended.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 Run(16000, 8000, 1000); 1772 Run(16000, 8000, 1000);
1763 } 1773 }
1764 1774
1765 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 1775 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
1766 Run(8000, 16000, 1000); 1776 Run(8000, 16000, 1000);
1767 } 1777 }
1768 1778
1769 #endif 1779 #endif
1770 1780
1771 } // namespace webrtc 1781 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698