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

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: Addressed comment 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
« no previous file with comments | « remoting/host/audio_capturer_win.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5b71ae43f98425d86f86068ab7af313b4ee86e6a
--- /dev/null
+++ b/remoting/host/audio_capturer_win_unittest.cc
@@ -0,0 +1,29 @@
+// 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 "base/basictypes.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+
+TEST(AudioCapturerWinTest, SilenceTest) {
+ int16 samples1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int16 samples2[] = {65, 73, 83, 89, 92, -1, 5, 9, 123, 0};
+ int16 samples3[] = {0, 0, 0, 0, 1, 0, 0, -1, 0, 0};
+ // MSVC++ doesn't allow allocating arrays of size 0.
+ int16 samples4[] = {0};
+
+ ASSERT_TRUE(
+ AudioCapturerWin::IsPacketOfSilence(samples1, arraysize(samples1)));
+ ASSERT_FALSE(
+ AudioCapturerWin::IsPacketOfSilence(samples2, arraysize(samples2)));
+ ASSERT_TRUE(
+ AudioCapturerWin::IsPacketOfSilence(samples3, arraysize(samples3)));
+ ASSERT_TRUE(
+ AudioCapturerWin::IsPacketOfSilence(samples4, 0));
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/audio_capturer_win.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698