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

Unified Diff: content/renderer/media/media_stream_audio_processor_unittest.cc

Issue 1224623014: Refactor ParseArrayGeometry to use standard Chromium facilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge fix and clang-format. Created 5 years, 5 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: content/renderer/media/media_stream_audio_processor_unittest.cc
diff --git a/content/renderer/media/media_stream_audio_processor_unittest.cc b/content/renderer/media/media_stream_audio_processor_unittest.cc
index 5c86e6c88ca8715626d2772e6b159ca77c77e16b..7ec865625801a6c4d9d637ed67e96ece874c4d05 100644
--- a/content/renderer/media/media_stream_audio_processor_unittest.cc
+++ b/content/renderer/media/media_stream_audio_processor_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <vector>
+
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
@@ -525,4 +527,35 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestWithKeyboardMicChannel) {
audio_processor = NULL;
}
+using Point = webrtc::Point;
+using PointVector = std::vector<Point>;
+
+void ExpectPointVectorEqual(const PointVector& expected,
+ const PointVector& actual) {
+ EXPECT_EQ(expected.size(), actual.size());
+ for (size_t i = 0; i < actual.size(); ++i) {
+ EXPECT_EQ(expected[i].x(), actual[i].x());
+ EXPECT_EQ(expected[i].y(), actual[i].y());
+ EXPECT_EQ(expected[i].z(), actual[i].z());
+ }
+}
+
+TEST(MediaStreamAudioProcessorOptionsTest, ParseArrayGeometry) {
+ const PointVector expected_empty;
+ ExpectPointVectorEqual(expected_empty, ParseArrayGeometry(""));
+ ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("0 0 a"));
+ ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("1 2"));
+ ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("1 2 3 4"));
+
+ {
+ PointVector expected(1, Point(0, 0, 0));
+ expected.push_back(Point(0.04, 0, 0));
+ ExpectPointVectorEqual(expected, ParseArrayGeometry("0 0 0 0.04 0 0"));
+ }
+ {
+ PointVector expected(1, Point(1, 2, 3));
+ ExpectPointVectorEqual(expected, ParseArrayGeometry("1 2 3"));
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698