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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 2747863003: Loosening the coupling between WebRTC and //third_party/protobuf (Closed)
Patch Set: Fixing the build when rtc_enable_protobuf if false Created 3 years, 9 months 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
OLDNEW
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
(...skipping 16 matching lines...) Expand all
27 #include "webrtc/base/stringencode.h" 27 #include "webrtc/base/stringencode.h"
28 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" 28 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
29 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" 29 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
30 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" 30 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
31 #include "webrtc/modules/include/module_common_types.h" 31 #include "webrtc/modules/include/module_common_types.h"
32 #include "webrtc/test/gtest.h" 32 #include "webrtc/test/gtest.h"
33 #include "webrtc/test/testsupport/fileutils.h" 33 #include "webrtc/test/testsupport/fileutils.h"
34 #include "webrtc/typedefs.h" 34 #include "webrtc/typedefs.h"
35 35
36 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT 36 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
37 #include "webrtc/base/protobuf_utils.h"
37 RTC_PUSH_IGNORING_WUNDEF() 38 RTC_PUSH_IGNORING_WUNDEF()
38 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 39 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
39 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" 40 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h"
40 #else 41 #else
41 #include "webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" 42 #include "webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h"
42 #endif 43 #endif
43 RTC_POP_IGNORING_WUNDEF() 44 RTC_POP_IGNORING_WUNDEF()
44 #endif 45 #endif
45 46
46 DEFINE_bool(gen_ref, false, "Generate reference files."); 47 DEFINE_bool(gen_ref, false, "Generate reference files.");
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ASSERT_EQ(length, fwrite(&test_results, sizeof(T), length, output_fp_)); 188 ASSERT_EQ(length, fwrite(&test_results, sizeof(T), length, output_fp_));
188 } 189 }
189 digest_->Update(&test_results, sizeof(T) * length); 190 digest_->Update(&test_results, sizeof(T) * length);
190 } 191 }
191 192
192 void ResultSink::AddResult(const NetEqNetworkStatistics& stats_raw) { 193 void ResultSink::AddResult(const NetEqNetworkStatistics& stats_raw) {
193 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT 194 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
194 neteq_unittest::NetEqNetworkStatistics stats; 195 neteq_unittest::NetEqNetworkStatistics stats;
195 Convert(stats_raw, &stats); 196 Convert(stats_raw, &stats);
196 197
197 std::string stats_string; 198 ProtoString stats_string;
198 ASSERT_TRUE(stats.SerializeToString(&stats_string)); 199 ASSERT_TRUE(stats.SerializeToString(&stats_string));
199 AddMessage(output_fp_, digest_.get(), stats_string); 200 AddMessage(output_fp_, digest_.get(), stats_string);
200 #else 201 #else
201 FAIL() << "Writing to reference file requires Proto Buffer."; 202 FAIL() << "Writing to reference file requires Proto Buffer.";
202 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT 203 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
203 } 204 }
204 205
205 void ResultSink::AddResult(const RtcpStatistics& stats_raw) { 206 void ResultSink::AddResult(const RtcpStatistics& stats_raw) {
206 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT 207 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
207 neteq_unittest::RtcpStatistics stats; 208 neteq_unittest::RtcpStatistics stats;
208 Convert(stats_raw, &stats); 209 Convert(stats_raw, &stats);
209 210
210 std::string stats_string; 211 ProtoString stats_string;
211 ASSERT_TRUE(stats.SerializeToString(&stats_string)); 212 ASSERT_TRUE(stats.SerializeToString(&stats_string));
212 AddMessage(output_fp_, digest_.get(), stats_string); 213 AddMessage(output_fp_, digest_.get(), stats_string);
213 #else 214 #else
214 FAIL() << "Writing to reference file requires Proto Buffer."; 215 FAIL() << "Writing to reference file requires Proto Buffer.";
215 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT 216 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
216 } 217 }
217 218
218 void ResultSink::VerifyChecksum(const std::string& checksum) { 219 void ResultSink::VerifyChecksum(const std::string& checksum) {
219 std::vector<char> buffer; 220 std::vector<char> buffer;
220 buffer.resize(digest_->Size()); 221 buffer.resize(digest_->Size());
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 if (muted) { 1582 if (muted) {
1582 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1583 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1583 } else { 1584 } else {
1584 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1585 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1585 } 1586 }
1586 } 1587 }
1587 EXPECT_FALSE(muted); 1588 EXPECT_FALSE(muted);
1588 } 1589 }
1589 1590
1590 } // namespace webrtc 1591 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698