Title: [127906] trunk
Revision
127906
Author
tom...@google.com
Date
2012-09-07 12:30:55 -0700 (Fri, 07 Sep 2012)

Log Message

MediaStream API: add RTCPeerConnection::createAnswer
https://bugs.webkit.org/show_bug.cgi?id=96092

Reviewed by Adam Barth.

Source/Platform:

* chromium/public/WebRTCPeerConnectionHandler.h:
(WebRTCPeerConnectionHandler):

Source/WebCore:

Test: fast/mediastream/RTCPeerConnection-createAnswer.html

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::createAnswer):
(WebCore):
* Modules/mediastream/RTCPeerConnection.h:
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* platform/mediastream/RTCPeerConnectionHandler.cpp:
(RTCPeerConnectionHandlerDummy):
(WebCore::RTCPeerConnectionHandlerDummy::createAnswer):
(WebCore):
* platform/mediastream/RTCPeerConnectionHandler.h:
(RTCPeerConnectionHandler):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::createAnswer):
(WebCore):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Tools:

Expanding and enhancing MockWebRTCPeerConnectionHandler.

* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(MockWebRTCPeerConnectionHandler::createOffer):
(MockWebRTCPeerConnectionHandler::createAnswer):
(MockWebRTCPeerConnectionHandler::setLocalDescription):
(MockWebRTCPeerConnectionHandler::setRemoteDescription):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
(MockWebRTCPeerConnectionHandler):

LayoutTests:

* fast/mediastream/RTCPeerConnection-createAnswer-expected.txt: Added.
* fast/mediastream/RTCPeerConnection-createAnswer.html: Added.
* fast/mediastream/RTCPeerConnection-createOffer-expected.txt:
* fast/mediastream/RTCPeerConnection-createOffer.html:
* fast/mediastream/RTCPeerConnection-localDescription-expected.txt:
* fast/mediastream/RTCPeerConnection-localDescription.html:
* fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt:
* fast/mediastream/RTCPeerConnection-remoteDescription.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127905 => 127906)


--- trunk/LayoutTests/ChangeLog	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/ChangeLog	2012-09-07 19:30:55 UTC (rev 127906)
@@ -1,3 +1,19 @@
+2012-09-07  Tommy Widenflycht  <tom...@google.com>
+
+        MediaStream API: add RTCPeerConnection::createAnswer
+        https://bugs.webkit.org/show_bug.cgi?id=96092
+
+        Reviewed by Adam Barth.
+
+        * fast/mediastream/RTCPeerConnection-createAnswer-expected.txt: Added.
+        * fast/mediastream/RTCPeerConnection-createAnswer.html: Added.
+        * fast/mediastream/RTCPeerConnection-createOffer-expected.txt:
+        * fast/mediastream/RTCPeerConnection-createOffer.html:
+        * fast/mediastream/RTCPeerConnection-localDescription-expected.txt:
+        * fast/mediastream/RTCPeerConnection-localDescription.html:
+        * fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt:
+        * fast/mediastream/RTCPeerConnection-remoteDescription.html:
+
 2012-09-07  Xianzhu Wang  <wangxian...@chromium.org>
 
         Unreviewed. Update test expectation media/video-set-rate-from-pause.html on Android.

Added: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer-expected.txt (0 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer-expected.txt	2012-09-07 19:30:55 UTC (rev 127906)
@@ -0,0 +1,14 @@
+Tests RTCPeerConnection createAnswer.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS createOffer request failed.
+PASS pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2); did not throw exception.
+PASS setRemoteDescription request succeeded.
+PASS pc.createAnswer(requestSucceeded3, requestFailed3); did not throw exception.
+PASS createAnswer request succeeded.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer.html (0 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer.html	2012-09-07 19:30:55 UTC (rev 127906)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Tests RTCPeerConnection createAnswer.");
+
+var pc = null;
+
+function requestFailed3(reason)
+{
+    testFailed('createAnswer request failed.');
+
+    finishJSTest();
+}
+
+function requestSucceeded3()
+{
+    testPassed('createAnswer request succeeded.');
+
+    finishJSTest();
+}
+
+function requestFailed2(reason)
+{
+    testFailed('setRemoteDescription request failed.');
+
+    finishJSTest();
+}
+
+function requestSucceeded2()
+{
+    testPassed('setRemoteDescription request succeeded.');
+
+    shouldNotThrow('pc.createAnswer(requestSucceeded3, requestFailed3);');
+}
+
+function requestFailed1()
+{
+    testPassed('createOffer request failed.');
+
+    sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
+    shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2);');
+}
+
+function requestSucceeded1(sd)
+{
+    testFailed('createOffer request succeeded.');
+    finishJSTest();
+}
+
+pc = new webkitRTCPeerConnection(null, null);
+pc.createOffer(requestSucceeded1, requestFailed1);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer-expected.txt (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer-expected.txt	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer-expected.txt	2012-09-07 19:30:55 UTC (rev 127906)
@@ -1,4 +1,4 @@
-Tests RTCPeerConnection [add|remove]Stream.
+Tests RTCPeerConnection createOffer.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html	2012-09-07 19:30:55 UTC (rev 127906)
@@ -5,7 +5,7 @@
 </head>
 <body>
 <script>
-description("Tests RTCPeerConnection [add|remove]Stream.");
+description("Tests RTCPeerConnection createOffer.");
 
 var pc = null;
 

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription-expected.txt	2012-09-07 19:30:55 UTC (rev 127906)
@@ -7,7 +7,7 @@
 PASS requestSucceeded was called.
 PASS pc.setLocalDescription(sessionDescription, requestSucceeded2, requestFailed2); did not throw exception.
 PASS requestFailed was called.
-PASS pc.localDescription.sdp is "sdp1"
+PASS pc.localDescription.type is "offer"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html	2012-09-07 19:30:55 UTC (rev 127906)
@@ -13,7 +13,7 @@
 {
     testPassed('requestFailed was called.');
 
-    shouldBe('pc.localDescription.sdp', '"sdp1"');
+    shouldBe('pc.localDescription.type', '"offer"');
     finishJSTest();
 }
 
@@ -33,12 +33,12 @@
 {
     testPassed('requestSucceeded was called.');
 
-    sessionDescription = new RTCSessionDescription({type:"answer", sdp:"sdp2"});
+    sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
     shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded2, requestFailed2);');
 }
 
 pc = new webkitRTCPeerConnection(null, null);
-var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"sdp1"});
+var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
 shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, requestFailed1);');
 
 

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt	2012-09-07 19:30:55 UTC (rev 127906)
@@ -7,7 +7,7 @@
 PASS requestSucceeded was called.
 PASS pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2); did not throw exception.
 PASS requestFailed was called.
-PASS pc.remoteDescription.sdp is "sdp1"
+PASS pc.remoteDescription.type is "answer"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html (127905 => 127906)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html	2012-09-07 19:30:55 UTC (rev 127906)
@@ -13,7 +13,7 @@
 {
     testPassed('requestFailed was called.');
 
-    shouldBe('pc.remoteDescription.sdp', '"sdp1"');
+    shouldBe('pc.remoteDescription.type', '"answer"');
     finishJSTest();
 }
 
@@ -33,12 +33,12 @@
 {
     testPassed('requestSucceeded was called.');
 
-    sessionDescription = new RTCSessionDescription({type:"offer", sdp:"sdp2"});
+    sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
     shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailed2);');
 }
 
 pc = new webkitRTCPeerConnection(null, null);
-var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"sdp1"});
+var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailed1);');
 
 

Modified: trunk/Source/Platform/ChangeLog (127905 => 127906)


--- trunk/Source/Platform/ChangeLog	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/Platform/ChangeLog	2012-09-07 19:30:55 UTC (rev 127906)
@@ -1,3 +1,13 @@
+2012-09-07  Tommy Widenflycht  <tom...@google.com>
+
+        MediaStream API: add RTCPeerConnection::createAnswer
+        https://bugs.webkit.org/show_bug.cgi?id=96092
+
+        Reviewed by Adam Barth.
+
+        * chromium/public/WebRTCPeerConnectionHandler.h:
+        (WebRTCPeerConnectionHandler):
+
 2012-09-07  Ian Vollick  <voll...@chromium.org>
 
         [chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed.

Modified: trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h (127905 => 127906)


--- trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h	2012-09-07 19:30:55 UTC (rev 127906)
@@ -48,6 +48,7 @@
     virtual bool initialize(const WebRTCConfiguration&, const WebMediaConstraints&) = 0;
 
     virtual void createOffer(const WebRTCSessionDescriptionRequest&, const WebMediaConstraints&) = 0;
+    virtual void createAnswer(const WebRTCSessionDescriptionRequest&, const WebMediaConstraints&) = 0;
     virtual void setLocalDescription(const WebRTCVoidRequest&, const WebRTCSessionDescriptionDescriptor&) = 0;
     virtual void setRemoteDescription(const WebRTCVoidRequest&, const WebRTCSessionDescriptionDescriptor&) = 0;
     virtual WebRTCSessionDescriptionDescriptor localDescription() = 0;

Modified: trunk/Source/WebCore/ChangeLog (127905 => 127906)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/ChangeLog	2012-09-07 19:30:55 UTC (rev 127906)
@@ -1,3 +1,30 @@
+2012-09-07  Tommy Widenflycht  <tom...@google.com>
+
+        MediaStream API: add RTCPeerConnection::createAnswer
+        https://bugs.webkit.org/show_bug.cgi?id=96092
+
+        Reviewed by Adam Barth.
+
+        Test: fast/mediastream/RTCPeerConnection-createAnswer.html
+
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::createAnswer):
+        (WebCore):
+        * Modules/mediastream/RTCPeerConnection.h:
+        (RTCPeerConnection):
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * platform/mediastream/RTCPeerConnectionHandler.cpp:
+        (RTCPeerConnectionHandlerDummy):
+        (WebCore::RTCPeerConnectionHandlerDummy::createAnswer):
+        (WebCore):
+        * platform/mediastream/RTCPeerConnectionHandler.h:
+        (RTCPeerConnectionHandler):
+        * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
+        (WebCore::RTCPeerConnectionHandlerChromium::createAnswer):
+        (WebCore):
+        * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
+        (RTCPeerConnectionHandlerChromium):
+
 2012-09-06  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (127905 => 127906)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2012-09-07 19:30:55 UTC (rev 127906)
@@ -157,6 +157,26 @@
     m_peerHandler->createOffer(request.release(), constraints);
 }
 
+void RTCPeerConnection::createAnswer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& mediaConstraints, ExceptionCode& ec)
+{
+    if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    if (!successCallback) {
+        ec = TYPE_MISMATCH_ERR;
+        return;
+    }
+
+    RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, ec);
+    if (ec)
+        return;
+
+    RefPtr<RTCSessionDescriptionRequestImpl> request = RTCSessionDescriptionRequestImpl::create(scriptExecutionContext(), successCallback, errorCallback);
+    m_peerHandler->createAnswer(request.release(), constraints.release());
+}
+
 void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionCode& ec)
 {
     if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) {

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (127905 => 127906)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2012-09-07 19:30:55 UTC (rev 127906)
@@ -60,6 +60,8 @@
 
     void createOffer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCErrorCallback>, const Dictionary& mediaConstraints, ExceptionCode&);
 
+    void createAnswer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCErrorCallback>, const Dictionary& mediaConstraints, ExceptionCode&);
+
     void setLocalDescription(PassRefPtr<RTCSessionDescription>, PassRefPtr<VoidCallback>, PassRefPtr<RTCErrorCallback>, ExceptionCode&);
     PassRefPtr<RTCSessionDescription> localDescription(ExceptionCode&);
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (127905 => 127906)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2012-09-07 19:30:55 UTC (rev 127906)
@@ -41,6 +41,9 @@
         void createOffer(in [Callback] RTCSessionDescriptionCallback successCallback, in [Callback,Optional=DefaultIsUndefined] RTCErrorCallback failureCallback, in [Optional=DefaultIsUndefined] Dictionary mediaConstraints)
             raises(DOMException);
 
+        void createAnswer(in [Callback] RTCSessionDescriptionCallback successCallback, in [Callback, Optional=DefaultIsUndefined] RTCErrorCallback failureCallback, in [Optional=DefaultIsUndefined] Dictionary mediaConstraints)
+            raises(DOMException);
+
         void setLocalDescription(in RTCSessionDescription description, in [Callback, Optional=DefaultIsUndefined] VoidCallback successCallback, in [Callback, Optional=DefaultIsUndefined] RTCErrorCallback failureCallback)
             raises(DOMException);
         readonly attribute RTCSessionDescription localDescription

Modified: trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp (127905 => 127906)


--- trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp	2012-09-07 19:30:55 UTC (rev 127906)
@@ -50,6 +50,7 @@
     virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE;
 
     virtual void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE;
+    virtual void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE;
     virtual void setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE;
     virtual void setRemoteDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE;
     virtual PassRefPtr<RTCSessionDescriptionDescriptor> localDescription() OVERRIDE;
@@ -88,6 +89,10 @@
 {
 }
 
+void RTCPeerConnectionHandlerDummy::createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>)
+{
+}
+
 void RTCPeerConnectionHandlerDummy::setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>)
 {
 }

Modified: trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h (127905 => 127906)


--- trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h	2012-09-07 19:30:55 UTC (rev 127906)
@@ -55,6 +55,7 @@
     virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) = 0;
 
     virtual void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) = 0;
+    virtual void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) = 0;
     virtual void setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) = 0;
     virtual void setRemoteDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) = 0;
     virtual PassRefPtr<RTCSessionDescriptionDescriptor> localDescription() = 0;

Modified: trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp (127905 => 127906)


--- trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp	2012-09-07 19:30:55 UTC (rev 127906)
@@ -83,6 +83,15 @@
     m_webHandler->createOffer(request, constraints);
 }
 
+void RTCPeerConnectionHandlerChromium::createAnswer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<MediaConstraints> constraints)
+{
+    // FIXME: Should the error callback be triggered here?
+    if (!m_webHandler)
+        return;
+
+    m_webHandler->createAnswer(request, constraints);
+}
+
 void RTCPeerConnectionHandlerChromium::setLocalDescription(PassRefPtr<RTCVoidRequest> request, PassRefPtr<RTCSessionDescriptionDescriptor> sessionDescription)
 {
     if (!m_webHandler)

Modified: trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h (127905 => 127906)


--- trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h	2012-09-07 19:30:55 UTC (rev 127906)
@@ -55,6 +55,7 @@
     virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE;
 
     virtual void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE;
+    virtual void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE;
     virtual void setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE;
     virtual void setRemoteDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE;
     virtual PassRefPtr<RTCSessionDescriptionDescriptor> localDescription() OVERRIDE;

Modified: trunk/Tools/ChangeLog (127905 => 127906)


--- trunk/Tools/ChangeLog	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Tools/ChangeLog	2012-09-07 19:30:55 UTC (rev 127906)
@@ -1,3 +1,20 @@
+2012-09-07  Tommy Widenflycht  <tom...@google.com>
+
+        MediaStream API: add RTCPeerConnection::createAnswer
+        https://bugs.webkit.org/show_bug.cgi?id=96092
+
+        Reviewed by Adam Barth.
+
+        Expanding and enhancing MockWebRTCPeerConnectionHandler.
+
+        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
+        (MockWebRTCPeerConnectionHandler::createOffer):
+        (MockWebRTCPeerConnectionHandler::createAnswer):
+        (MockWebRTCPeerConnectionHandler::setLocalDescription):
+        (MockWebRTCPeerConnectionHandler::setRemoteDescription):
+        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
+        (MockWebRTCPeerConnectionHandler):
+
 2012-09-07  Dean Jackson  <d...@apple.com>
 
         Unreviewed changes to watchlist.

Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp (127905 => 127906)


--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp	2012-09-07 19:30:55 UTC (rev 127906)
@@ -154,15 +154,25 @@
     WebString shouldSucceed;
     if (constraints.getMandatoryConstraintValue("succeed", shouldSucceed) && shouldSucceed == "true") {
         WebRTCSessionDescriptionDescriptor sessionDescription;
-        sessionDescription.initialize("offer", "Some SDP here");
+        sessionDescription.initialize("offer", "local");
         postTask(new RTCSessionDescriptionRequestSuccededTask(this, request, sessionDescription));
     } else
         postTask(new RTCSessionDescriptionRequestFailedTask(this, request));
 }
 
+void MockWebRTCPeerConnectionHandler::createAnswer(const WebRTCSessionDescriptionRequest& request, const WebMediaConstraints&)
+{
+    if (!m_remoteDescription.isNull()) {
+        WebRTCSessionDescriptionDescriptor sessionDescription;
+        sessionDescription.initialize("answer", "local");
+        postTask(new RTCSessionDescriptionRequestSuccededTask(this, request, sessionDescription));
+    } else
+        postTask(new RTCSessionDescriptionRequestFailedTask(this, request));
+}
+
 void MockWebRTCPeerConnectionHandler::setLocalDescription(const WebRTCVoidRequest& request, const WebRTCSessionDescriptionDescriptor& localDescription)
 {
-    if (!localDescription.isNull() && localDescription.type() == "offer") {
+    if (!localDescription.isNull() && localDescription.sdp() == "local") {
         m_localDescription = localDescription;
         postTask(new RTCVoidRequestTask(this, request, true));
     } else
@@ -171,7 +181,7 @@
 
 void MockWebRTCPeerConnectionHandler::setRemoteDescription(const WebRTCVoidRequest& request, const WebRTCSessionDescriptionDescriptor& remoteDescription)
 {
-    if (!remoteDescription.isNull() && remoteDescription.type() == "answer") {
+    if (!remoteDescription.isNull() && remoteDescription.sdp() == "remote") {
         m_remoteDescription = remoteDescription;
         postTask(new RTCVoidRequestTask(this, request, true));
     } else

Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h (127905 => 127906)


--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h	2012-09-07 19:20:06 UTC (rev 127905)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h	2012-09-07 19:30:55 UTC (rev 127906)
@@ -49,6 +49,7 @@
     virtual bool initialize(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE;
 
     virtual void createOffer(const WebKit::WebRTCSessionDescriptionRequest&, const WebKit::WebMediaConstraints&) OVERRIDE;
+    virtual void createAnswer(const WebKit::WebRTCSessionDescriptionRequest&, const WebKit::WebMediaConstraints&) OVERRIDE;
     virtual void setLocalDescription(const WebKit::WebRTCVoidRequest&, const WebKit::WebRTCSessionDescriptionDescriptor&) OVERRIDE;
     virtual void setRemoteDescription(const WebKit::WebRTCVoidRequest&, const WebKit::WebRTCSessionDescriptionDescriptor&) OVERRIDE;
     virtual WebKit::WebRTCSessionDescriptionDescriptor localDescription() OVERRIDE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to