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

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

Issue 1171033002: Ensures that modules_unittests runs on iOS (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebased Created 5 years, 6 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) 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 "webrtc/modules/audio_coding/neteq/audio_classifier.h" 11 #include "webrtc/modules/audio_coding/neteq/audio_classifier.h"
12 12
13 #include <math.h> 13 #include <math.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 #include <string.h> 16 #include <string.h>
17 #include <string> 17 #include <string>
18 18
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "webrtc/test/testsupport/fileutils.h" 20 #include "webrtc/test/testsupport/fileutils.h"
21 #include "webrtc/test/testsupport/gtest_disable.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 static const size_t kFrameSize = 960; 25 static const size_t kFrameSize = 960;
25 26
26 TEST(AudioClassifierTest, AllZeroInput) { 27 TEST(AudioClassifierTest, AllZeroInput) {
27 int16_t in_mono[kFrameSize] = {0}; 28 int16_t in_mono[kFrameSize] = {0};
28 29
29 // Test all-zero vectors and let the classifier converge from its default 30 // Test all-zero vectors and let the classifier converge from its default
30 // to the expected value. 31 // to the expected value.
(...skipping 22 matching lines...) Expand all
53 bool is_music = 54 bool is_music =
54 classifier.Analysis(in.get(), channels * kFrameSize, channels); 55 classifier.Analysis(in.get(), channels * kFrameSize, channels);
55 EXPECT_EQ(is_music, classifier.is_music()); 56 EXPECT_EQ(is_music, classifier.is_music());
56 ASSERT_EQ(1u, fread(&is_music_ref, sizeof(is_music_ref), 1, data_file)); 57 ASSERT_EQ(1u, fread(&is_music_ref, sizeof(is_music_ref), 1, data_file));
57 EXPECT_EQ(is_music_ref, is_music); 58 EXPECT_EQ(is_music_ref, is_music);
58 } 59 }
59 fclose(audio_file); 60 fclose(audio_file);
60 fclose(data_file); 61 fclose(data_file);
61 } 62 }
62 63
63 TEST(AudioClassifierTest, DoAnalysisMono) { 64 TEST(AudioClassifierTest, DISABLED_ON_IOS(DoAnalysisMono)) {
64 RunAnalysisTest(test::ResourcePath("short_mixed_mono_48", "pcm"), 65 RunAnalysisTest(test::ResourcePath("short_mixed_mono_48", "pcm"),
65 test::ResourcePath("short_mixed_mono_48", "dat"), 66 test::ResourcePath("short_mixed_mono_48", "dat"),
66 1); 67 1);
67 } 68 }
68 69
69 TEST(AudioClassifierTest, DoAnalysisStereo) { 70 TEST(AudioClassifierTest, DISABLED_ON_IOS(DoAnalysisStereo)) {
70 RunAnalysisTest(test::ResourcePath("short_mixed_stereo_48", "pcm"), 71 RunAnalysisTest(test::ResourcePath("short_mixed_stereo_48", "pcm"),
71 test::ResourcePath("short_mixed_stereo_48", "dat"), 72 test::ResourcePath("short_mixed_stereo_48", "dat"),
72 2); 73 2);
73 } 74 }
74 75
75 } // namespace webrtc 76 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698