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

Unified Diff: remoting/host/audio_capturer_win_unittest.cc

Issue 10823440: Silence detection test for the Windows audio capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/audio_capturer_win_unittest.cc
diff --git a/remoting/host/audio_capturer_win_unittest.cc b/remoting/host/audio_capturer_win_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c07ad6975af1a573699f26a1cb867df224ed9fde
--- /dev/null
+++ b/remoting/host/audio_capturer_win_unittest.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/audio_capturer_win.h"
+#include "testing/gtest/include/gtest/gtest.h"
Sergey Ulanov 2012/08/21 20:52:15 move this include after basictypes.h
kxing 2012/08/21 21:24:27 Done.
+
+#include "base/basictypes.h"
+
+namespace remoting {
+
+class AudioCapturerWinTest : public testing::Test {
Sergey Ulanov 2012/08/21 20:52:15 Don't really need this class. It's necessary only
kxing 2012/08/21 21:24:27 Done.
+};
+
+TEST_F(AudioCapturerWinTest, SilenceTest) {
+ int16 samples1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Sergey Ulanov 2012/08/21 20:52:15 Maybe add a test for an empty buffer?
kxing 2012/08/21 21:24:27 Done.
+ int16 samples2[] = {65, 73, 83, 89, 92, -1, 5, 9, 123, 0};
+ int16 samples3[] = {0, 0, 0, 0, 1, 0, 0, -1, 0, 0};
+
+ ASSERT_TRUE(AudioCapturerWin::IsPacketOfSilence(samples1, 10));
Sergey Ulanov 2012/08/21 20:52:15 here and below: s/10/arraysize(samples1)/
kxing 2012/08/21 21:24:27 Done.
+ ASSERT_FALSE(AudioCapturerWin::IsPacketOfSilence(samples2, 10));
+ ASSERT_TRUE(AudioCapturerWin::IsPacketOfSilence(samples3, 10));
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698