<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159823] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159823">159823</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-11-27 13:03:51 -0800 (Wed, 27 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Adding MediaConstraintsMock class
https://bugs.webkit.org/show_bug.cgi?id=124902

Patch by Thiago de Barros Lacerda &lt;thiago.lacerda@openbossa.org&gt; on 2013-11-27
Reviewed by Eric Carlson.

Validate constraints used in RTCPeerConnection LayoutTests

Source/WebCore:

Existing test was updated.

* CMakeLists.txt:
* GNUmakefile.list.am:
* platform/mock/MediaConstraintsMock.cpp: Added.
* platform/mock/MediaConstraintsMock.h: Added.
* platform/mock/MockMediaStreamCenter.cpp:
(WebCore::MockMediaStreamCenter::validateRequestConstraints): Now using MediaConstraintsMock
(WebCore::MockMediaStreamCenter::createMediaStream): Ditto.
* platform/mock/RTCPeerConnectionHandlerMock.cpp:
(WebCore::RTCPeerConnectionHandlerMock::initialize): Ditto.

LayoutTests:

* fast/mediastream/RTCPeerConnection-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamRTCPeerConnectionexpectedtxt">trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreplatformmockMockMediaStreamCentercpp">trunk/Source/WebCore/platform/mock/MockMediaStreamCenter.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmockRTCPeerConnectionHandlerMockcpp">trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmockMediaConstraintsMockcpp">trunk/Source/WebCore/platform/mock/MediaConstraintsMock.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmockMediaConstraintsMockh">trunk/Source/WebCore/platform/mock/MediaConstraintsMock.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/LayoutTests/ChangeLog        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2013-11-27  Thiago de Barros Lacerda  &lt;thiago.lacerda@openbossa.org&gt;
+
+        Adding MediaConstraintsMock class
+        https://bugs.webkit.org/show_bug.cgi?id=124902
+
+        Reviewed by Eric Carlson.
+
+        Validate constraints used in RTCPeerConnection LayoutTests
+
+        * fast/mediastream/RTCPeerConnection-expected.txt:
+
</ins><span class="cx"> 2013-11-27  Bear Travis  &lt;betravis@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] Shape-Inside Should Default to 'auto'
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamRTCPeerConnectionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -45,16 +45,16 @@
</span><span class="cx"> PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0}]}); did not throw exception.
</span><span class="cx"> PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]}); did not throw exception.
</span><span class="cx"> PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]}); did not throw exception.
</span><del>-PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:66}}); threw exception Error: NotSupportedError: DOM Exception 9.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{invalid:1}}); threw exception Error: NotSupportedError: DOM Exception 9.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1}}); threw exception Error: NotSupportedError: DOM Exception 9.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}}); threw exception Error: NotSupportedError: DOM Exception 9.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:{valid_and_supported_1:0}}); threw exception Error: TypeMismatchError: DOM Exception 17.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception Error: TypeMismatchError: DOM Exception 17.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{invalid:0}]}); threw exception Error: NotSupportedError: DOM Exception 9.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_1:1}); threw exception Error: TypeMismatchError: DOM Exception 17.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_but_unsupported_1:1}); threw exception Error: TypeMismatchError: DOM Exception 17.
-PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception Error: TypeMismatchError: DOM Exception 17.
</del><ins>+PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:66}}); threw exception TypeError: Error creating RTCPeerConnection.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{invalid:1}}); threw exception TypeError: Error creating RTCPeerConnection.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1}}); threw exception TypeError: Error creating RTCPeerConnection.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}}); threw exception TypeError: Error creating RTCPeerConnection.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:{valid_and_supported_1:0}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{invalid:0}]}); threw exception TypeError: Error creating RTCPeerConnection.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_1:1}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_but_unsupported_1:1}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
+PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/Source/WebCore/CMakeLists.txt        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -2028,6 +2028,7 @@
</span><span class="cx">     platform/mock/DeviceMotionClientMock.cpp
</span><span class="cx">     platform/mock/DeviceOrientationClientMock.cpp
</span><span class="cx">     platform/mock/GeolocationClientMock.cpp
</span><ins>+    platform/mock/MediaConstraintsMock.cpp
</ins><span class="cx">     platform/mock/MockMediaStreamCenter.cpp
</span><span class="cx">     platform/mock/RTCDataChannelHandlerMock.cpp
</span><span class="cx">     platform/mock/RTCNotifiersMock.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/Source/WebCore/ChangeLog        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2013-11-27  Thiago de Barros Lacerda  &lt;thiago.lacerda@openbossa.org&gt;
+
+        Adding MediaConstraintsMock class
+        https://bugs.webkit.org/show_bug.cgi?id=124902
+
+        Reviewed by Eric Carlson.
+
+        Validate constraints used in RTCPeerConnection LayoutTests
+
+        Existing test was updated.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * platform/mock/MediaConstraintsMock.cpp: Added.
+        * platform/mock/MediaConstraintsMock.h: Added.
+        * platform/mock/MockMediaStreamCenter.cpp:
+        (WebCore::MockMediaStreamCenter::validateRequestConstraints): Now using MediaConstraintsMock
+        (WebCore::MockMediaStreamCenter::createMediaStream): Ditto.
+        * platform/mock/RTCPeerConnectionHandlerMock.cpp:
+        (WebCore::RTCPeerConnectionHandlerMock::initialize): Ditto.
+
</ins><span class="cx"> 2013-11-27  Bear Travis  &lt;betravis@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] Shape-Inside Should Default to 'auto'
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -5449,6 +5449,8 @@
</span><span class="cx">         Source/WebCore/platform/mock/DeviceOrientationClientMock.h \
</span><span class="cx">         Source/WebCore/platform/mock/GeolocationClientMock.cpp \
</span><span class="cx">         Source/WebCore/platform/mock/GeolocationClientMock.h \
</span><ins>+        Source/WebCore/platform/mock/MediaConstraintsMock.cpp \
+        Source/WebCore/platform/mock/MediaConstraintsMock.h \
</ins><span class="cx">         Source/WebCore/platform/mock/MockMediaStreamCenter.cpp \
</span><span class="cx">         Source/WebCore/platform/mock/MockMediaStreamCenter.h \
</span><span class="cx">         Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp \
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMediaConstraintsMockcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/mock/MediaConstraintsMock.cpp (0 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MediaConstraintsMock.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/mock/MediaConstraintsMock.cpp        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &quot;MediaConstraintsMock.h&quot;
+
+#include &quot;MediaConstraints.h&quot;
+
+namespace WebCore {
+
+bool isSupported(const String&amp; constraint)
+{
+    return notFound != constraint.find(&quot;_and_supported_&quot;);
+}
+
+bool isValid(const String&amp; constraint)
+{
+    return isSupported(constraint) || notFound != constraint.find(&quot;valid_&quot;);
+}
+
+String MediaConstraintsMock::verifyConstraints(PassRefPtr&lt;MediaConstraints&gt; prpConstraints)
+{
+    RefPtr&lt;MediaConstraints&gt; constraints = prpConstraints;
+
+    Vector&lt;MediaConstraint&gt; mandatoryConstraints;
+    constraints-&gt;getMandatoryConstraints(mandatoryConstraints);
+    if (mandatoryConstraints.size()) {
+        for (size_t i = 0; i &lt; mandatoryConstraints.size(); ++i) {
+            const MediaConstraint&amp; curr = mandatoryConstraints[i];
+            if (!isSupported(curr.m_name) || curr.m_value != &quot;1&quot;)
+                return curr.m_name;
+        }
+    }
+
+    Vector&lt;MediaConstraint&gt; optionalConstraints;
+    constraints-&gt;getOptionalConstraints(optionalConstraints);
+    if (optionalConstraints.size()) {
+        for (size_t i = 0; i &lt; optionalConstraints.size(); ++i) {
+            const MediaConstraint&amp; curr = optionalConstraints[i];
+            if (!isValid(curr.m_name) || curr.m_value != &quot;0&quot;)
+                return curr.m_name;
+        }
+    }
+
+    return emptyString();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMediaConstraintsMockh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/mock/MediaConstraintsMock.h (0 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MediaConstraintsMock.h                                (rev 0)
+++ trunk/Source/WebCore/platform/mock/MediaConstraintsMock.h        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaConstraintsMock_h
+#define MediaConstraintsMock_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class MediaConstraints;
+
+class MediaConstraintsMock {
+public:
+    static String verifyConstraints(PassRefPtr&lt;MediaConstraints&gt;);
+};
+
+} // namespace WebCore
+
+#endif // MockMediaConstraints_h
+
+#endif // ENABLE(MEDIA_STREAM)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMockMediaStreamCentercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/MockMediaStreamCenter.cpp (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MockMediaStreamCenter.cpp        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/Source/WebCore/platform/mock/MockMediaStreamCenter.cpp        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2013 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
</span><ins>+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,10 +26,12 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-#include &quot;MockMediaStreamCenter.h&quot;
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><ins>+#include &quot;MockMediaStreamCenter.h&quot;
+
+#include &quot;MediaConstraintsMock.h&quot;
</ins><span class="cx"> #include &quot;MediaStream.h&quot;
</span><span class="cx"> #include &quot;MediaStreamCreationClient.h&quot;
</span><span class="cx"> #include &quot;MediaStreamPrivate.h&quot;
</span><span class="lines">@@ -125,43 +128,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isSupportedMockConstraint(const String&amp; constraintName)
-{
-    return notFound != constraintName.find(&quot;_and_supported_&quot;);
-}
-
-static bool isValidMockConstraint(const String&amp; constraintName)
-{
-    if (isSupportedMockConstraint(constraintName))
-        return true;
-    return notFound != constraintName.find(&quot;_but_unsupported_&quot;);
-}
-
-static String verifyConstraints(MediaConstraints* constraints)
-{
-    Vector&lt;MediaConstraint&gt; mandatoryConstraints;
-    constraints-&gt;getMandatoryConstraints(mandatoryConstraints);
-    if (mandatoryConstraints.size()) {
-        for (size_t i = 0; i &lt; mandatoryConstraints.size(); ++i) {
-            const MediaConstraint&amp; constraint = mandatoryConstraints[i];
-            if (!isSupportedMockConstraint(constraint.m_name) || constraint.m_value != &quot;1&quot;)
-                return constraint.m_name;
-        }
-    }
-    
-    Vector&lt;MediaConstraint&gt; optionalConstraints;
-    constraints-&gt;getOptionalConstraints(optionalConstraints);
-    if (optionalConstraints.size()) {
-        for (size_t i = 0; i &lt; optionalConstraints.size(); ++i) {
-            const MediaConstraint&amp; constraint = optionalConstraints[i];
-            if (!isValidMockConstraint(constraint.m_name) || constraint.m_value != &quot;0&quot;)
-                return constraint.m_name;
-        }
-    }
-    
-    return emptyString();
-}
-
</del><span class="cx"> void MockMediaStreamCenter::validateRequestConstraints(PassRefPtr&lt;MediaStreamCreationClient&gt; prpQueryClient, PassRefPtr&lt;MediaConstraints&gt; audioConstraints, PassRefPtr&lt;MediaConstraints&gt; videoConstraints)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;MediaStreamCreationClient&gt; client = prpQueryClient;
</span><span class="lines">@@ -169,7 +135,7 @@
</span><span class="cx">     ASSERT(client);
</span><span class="cx">     
</span><span class="cx">     if (audioConstraints) {
</span><del>-        String invalidQuery = verifyConstraints(audioConstraints.get());
</del><ins>+        String invalidQuery = MediaConstraintsMock::verifyConstraints(audioConstraints);
</ins><span class="cx">         if (!invalidQuery.isEmpty()) {
</span><span class="cx">             client-&gt;constraintsInvalid(invalidQuery);
</span><span class="cx">             return;
</span><span class="lines">@@ -177,7 +143,7 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (videoConstraints) {
</span><del>-        String invalidQuery = verifyConstraints(videoConstraints.get());
</del><ins>+        String invalidQuery = MediaConstraintsMock::verifyConstraints(videoConstraints);
</ins><span class="cx">         if (!invalidQuery.isEmpty()) {
</span><span class="cx">             client-&gt;constraintsInvalid(invalidQuery);
</span><span class="cx">             return;
</span><span class="lines">@@ -198,7 +164,7 @@
</span><span class="cx">     MockSourceMap&amp; map = mockSourceMap();
</span><span class="cx"> 
</span><span class="cx">     if (audioConstraints) {
</span><del>-        String invalidQuery = verifyConstraints(audioConstraints.get());
</del><ins>+        String invalidQuery = MediaConstraintsMock::verifyConstraints(audioConstraints);
</ins><span class="cx">         if (!invalidQuery.isEmpty()) {
</span><span class="cx">             client-&gt;failedToCreateStreamWithConstraintsError(invalidQuery);
</span><span class="cx">             return;
</span><span class="lines">@@ -214,7 +180,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (videoConstraints) {
</span><del>-        String invalidQuery = verifyConstraints(videoConstraints.get());
</del><ins>+        String invalidQuery = MediaConstraintsMock::verifyConstraints(videoConstraints);
</ins><span class="cx">         if (!invalidQuery.isEmpty()) {
</span><span class="cx">             client-&gt;failedToCreateStreamWithConstraintsError(invalidQuery);
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockRTCPeerConnectionHandlerMockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp (159822 => 159823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp        2013-11-27 20:19:48 UTC (rev 159822)
+++ trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp        2013-11-27 21:03:51 UTC (rev 159823)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;RTCPeerConnectionHandlerMock.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;MediaConstraintsMock.h&quot;
</ins><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> #include &quot;RTCDTMFSenderHandler.h&quot;
</span><span class="cx"> #include &quot;RTCDataChannelHandler.h&quot;
</span><span class="lines">@@ -45,11 +46,12 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RTCPeerConnectionHandlerMock::initialize(PassRefPtr&lt;RTCConfiguration&gt;, PassRefPtr&lt;MediaConstraints&gt;)
</del><ins>+bool RTCPeerConnectionHandlerMock::initialize(PassRefPtr&lt;RTCConfiguration&gt;, PassRefPtr&lt;MediaConstraints&gt; constraints)
</ins><span class="cx"> {
</span><del>-    // FIXME: once there is support in RTCPeerConnection + constraints, this should be taken into account here
-    // and a LayouTest for that must be added.
-    // https://bugs.webkit.org/show_bug.cgi?id=123093
</del><ins>+    String invalidQuery = MediaConstraintsMock::verifyConstraints(constraints);
+    if (!invalidQuery.isEmpty())
+        return false;
+
</ins><span class="cx">     RefPtr&lt;IceConnectionNotifier&gt; notifier = adoptRef(new IceConnectionNotifier(m_client, RTCPeerConnectionHandlerClient::IceConnectionStateCompleted, RTCPeerConnectionHandlerClient::IceGatheringStateComplete));
</span><span class="cx">     m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
</span><span class="cx">     return true;
</span></span></pre>
</div>
</div>

</body>
</html>