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 |
index 99d9f56244b49030173e76e88303b1c6eb246355..5708d50bf2f1e061da480cdbcbfa729a2795df4c 100644 |
--- a/content/renderer/media/mock_media_constraint_factory.cc |
+++ b/content/renderer/media/mock_media_constraint_factory.cc |
@@ -9,6 +9,13 @@ |
namespace content { |
+namespace { |
+ |
+static const char kValueTrue[] = "true"; |
+static const char kValueFalse[] = "false"; |
+ |
+} // namespace |
+ |
MockMediaConstraintFactory::MockMediaConstraintFactory() { |
} |
@@ -37,6 +44,18 @@ void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
base::UTF8ToUTF16(base::DoubleToString(value)))); |
} |
+void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
+ const std::string& value) { |
+ mandatory_.push_back(blink::WebMediaConstraint( |
+ base::UTF8ToUTF16(key), base::UTF8ToUTF16(value))); |
+} |
+ |
+void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
+ bool value) { |
+ const std::string string_value = value ? kValueTrue : kValueFalse; |
+ AddMandatory(key, string_value); |
+} |
+ |
void MockMediaConstraintFactory::AddOptional(const std::string& key, |
int value) { |
optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), |
@@ -50,6 +69,18 @@ void MockMediaConstraintFactory::AddOptional(const std::string& key, |
base::UTF8ToUTF16(base::DoubleToString(value)))); |
} |
+void MockMediaConstraintFactory::AddOptional(const std::string& key, |
+ const std::string& value) { |
+ optional_.push_back(blink::WebMediaConstraint( |
+ base::UTF8ToUTF16(key), base::UTF8ToUTF16(value))); |
+} |
+ |
+void MockMediaConstraintFactory::AddOptional(const std::string& key, |
+ bool value) { |
+ const std::string string_value = value ? kValueTrue : kValueFalse; |
+ AddOptional(key, string_value); |
+} |
+ |
void MockMediaConstraintFactory::DisableDefaultAudioConstraints() { |
static const char* kDefaultAudioConstraints[] = { |
webrtc::MediaConstraintsInterface::kEchoCancellation, |
@@ -62,7 +93,7 @@ void MockMediaConstraintFactory::DisableDefaultAudioConstraints() { |
webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression |
}; |
MockMediaConstraintFactory factory; |
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { |
+ for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { |
AddMandatory(kDefaultAudioConstraints[i], false); |
} |
} |