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

Unified Diff: Source/testing/runner/MockConstraints.cpp

Issue 23444052: MediaStream API: Updating NavigatorUserMediaError (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added a test Created 7 years, 3 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 | « Source/testing/runner/MockConstraints.h ('k') | Source/testing/runner/WebUserMediaClientMock.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/testing/runner/MockConstraints.cpp
diff --git a/Source/testing/runner/MockConstraints.cpp b/Source/testing/runner/MockConstraints.cpp
index f80c0f8765bd006069524ce06801e63ecd70946d..b61d1917b78eee301442dd8b06a1091eba0d37f7 100644
--- a/Source/testing/runner/MockConstraints.cpp
+++ b/Source/testing/runner/MockConstraints.cpp
@@ -31,6 +31,7 @@
#include "MockConstraints.h"
#include "public/platform/WebMediaConstraints.h"
+#include "public/platform/WebString.h"
using namespace WebKit;
@@ -50,15 +51,18 @@ bool isValid(const WebString& constraint)
}
-bool MockConstraints::verifyConstraints(const WebMediaConstraints& constraints)
+bool MockConstraints::verifyConstraints(const WebMediaConstraints& constraints, WebString* failedConstraint)
{
WebVector<WebMediaConstraint> mandatoryConstraints;
constraints.getMandatoryConstraints(mandatoryConstraints);
if (mandatoryConstraints.size()) {
for (size_t i = 0; i < mandatoryConstraints.size(); ++i) {
const WebMediaConstraint& curr = mandatoryConstraints[i];
- if (!isSupported(curr.m_name) || curr.m_value != "1")
+ if (!isSupported(curr.m_name) || curr.m_value != "1") {
+ if (failedConstraint)
+ *failedConstraint = curr.m_name;
return false;
+ }
}
}
@@ -67,8 +71,11 @@ bool MockConstraints::verifyConstraints(const WebMediaConstraints& constraints)
if (optionalConstraints.size()) {
for (size_t i = 0; i < optionalConstraints.size(); ++i) {
const WebMediaConstraint& curr = optionalConstraints[i];
- if (!isValid(curr.m_name) || curr.m_value != "0")
+ if (!isValid(curr.m_name) || curr.m_value != "0") {
+ if (failedConstraint)
+ *failedConstraint = curr.m_name;
return false;
+ }
}
}
« no previous file with comments | « Source/testing/runner/MockConstraints.h ('k') | Source/testing/runner/WebUserMediaClientMock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698