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

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

Issue 190643003: Fix/Add content_unittests to work for the code behind --enable-audio-track-processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed an empty line. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/mock_media_constraint_factory.cc
diff --git a/content/renderer/media/mock_media_constraint_factory.cc b/content/renderer/media/mock_media_constraint_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..99d9f56244b49030173e76e88303b1c6eb246355
--- /dev/null
+++ b/content/renderer/media/mock_media_constraint_factory.cc
@@ -0,0 +1,70 @@
+// Copyright 2014 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 "base/strings/string_number_conversions.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/renderer/media/mock_media_constraint_factory.h"
+#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h"
+
+namespace content {
+
+MockMediaConstraintFactory::MockMediaConstraintFactory() {
+}
+
+MockMediaConstraintFactory::~MockMediaConstraintFactory() {
+}
+
+blink::WebMediaConstraints
+MockMediaConstraintFactory::CreateWebMediaConstraints() {
+ blink::WebVector<blink::WebMediaConstraint> mandatory(mandatory_);
+ blink::WebVector<blink::WebMediaConstraint> optional(optional_);
+ blink::WebMediaConstraints constraints;
+ constraints.initialize(optional, mandatory);
+ return constraints;
+}
+
+void MockMediaConstraintFactory::AddMandatory(const std::string& key,
+ int value) {
+ mandatory_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key),
+ base::IntToString16(value)));
+}
+
+void MockMediaConstraintFactory::AddMandatory(const std::string& key,
+ double value) {
+ mandatory_.push_back(blink::WebMediaConstraint(
+ base::UTF8ToUTF16(key),
+ base::UTF8ToUTF16(base::DoubleToString(value))));
+}
+
+void MockMediaConstraintFactory::AddOptional(const std::string& key,
+ int value) {
+ optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key),
+ base::IntToString16(value)));
+}
+
+void MockMediaConstraintFactory::AddOptional(const std::string& key,
+ double value) {
+ optional_.push_back(blink::WebMediaConstraint(
+ base::UTF8ToUTF16(key),
+ base::UTF8ToUTF16(base::DoubleToString(value))));
+}
+
+void MockMediaConstraintFactory::DisableDefaultAudioConstraints() {
+ static const char* kDefaultAudioConstraints[] = {
+ webrtc::MediaConstraintsInterface::kEchoCancellation,
+ webrtc::MediaConstraintsInterface::kExperimentalEchoCancellation,
+ webrtc::MediaConstraintsInterface::kAutoGainControl,
+ webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl,
+ webrtc::MediaConstraintsInterface::kNoiseSuppression,
+ webrtc::MediaConstraintsInterface::kHighpassFilter,
+ webrtc::MediaConstraintsInterface::kTypingNoiseDetection,
+ webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression
+ };
+ MockMediaConstraintFactory factory;
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) {
+ AddMandatory(kDefaultAudioConstraints[i], false);
+ }
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/media/mock_media_constraint_factory.h ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698