MediaStream API: Update RTCDataChannel to match the specification
Just adding a bunch of attributes and deprecating one.

BUG=266333

Review URL: https://chromiumcodereview.appspot.com/21350002

git-svn-id: svn://svn.chromium.org/blink/trunk@155254 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/platform/mediastream/RTCDataChannelHandler.cpp b/Source/core/platform/mediastream/RTCDataChannelHandler.cpp
index adc6fbf..cd3d749 100644
--- a/Source/core/platform/mediastream/RTCDataChannelHandler.cpp
+++ b/Source/core/platform/mediastream/RTCDataChannelHandler.cpp
@@ -53,16 +53,46 @@
     m_webHandler->setClient(m_client ? this : 0);
 }
 
-String RTCDataChannelHandler::label()
+String RTCDataChannelHandler::label() const
 {
     return m_webHandler->label();
 }
 
-bool RTCDataChannelHandler::isReliable()
+bool RTCDataChannelHandler::isReliable() const
 {
     return m_webHandler->isReliable();
 }
 
+bool RTCDataChannelHandler::ordered() const
+{
+    return m_webHandler->ordered();
+}
+
+unsigned short RTCDataChannelHandler::maxRetransmitTime() const
+{
+    return m_webHandler->maxRetransmitTime();
+}
+
+unsigned short RTCDataChannelHandler::maxRetransmits() const
+{
+    return m_webHandler->maxRetransmits();
+}
+
+String RTCDataChannelHandler::protocol() const
+{
+    return m_webHandler->protocol();
+}
+
+bool RTCDataChannelHandler::negotiated() const
+{
+    return m_webHandler->negotiated();
+}
+
+unsigned short RTCDataChannelHandler::id() const
+{
+    return m_webHandler->id();
+}
+
 unsigned long RTCDataChannelHandler::bufferedAmount()
 {
     return m_webHandler->bufferedAmount();
diff --git a/Source/core/platform/mediastream/RTCDataChannelHandler.h b/Source/core/platform/mediastream/RTCDataChannelHandler.h
index 18a4055..70a3076 100644
--- a/Source/core/platform/mediastream/RTCDataChannelHandler.h
+++ b/Source/core/platform/mediastream/RTCDataChannelHandler.h
@@ -43,8 +43,18 @@
 
     void setClient(RTCDataChannelHandlerClient*);
 
-    String label();
-    bool isReliable();
+    String label() const;
+
+    // DEPRECATED
+    bool isReliable() const;
+
+    bool ordered() const;
+    unsigned short maxRetransmitTime() const;
+    unsigned short maxRetransmits() const;
+    String protocol() const;
+    bool negotiated() const;
+    unsigned short id() const;
+
     unsigned long bufferedAmount();
     bool sendStringData(const String&);
     bool sendRawData(const char*, size_t);
diff --git a/Source/modules/mediastream/RTCDataChannel.cpp b/Source/modules/mediastream/RTCDataChannel.cpp
index 9f3c7b9..d90f8e7 100644
--- a/Source/modules/mediastream/RTCDataChannel.cpp
+++ b/Source/modules/mediastream/RTCDataChannel.cpp
@@ -80,6 +80,36 @@
     return m_handler->isReliable();
 }
 
+bool RTCDataChannel::ordered() const
+{
+    return m_handler->ordered();
+}
+
+unsigned short RTCDataChannel::maxRetransmitTime() const
+{
+    return m_handler->maxRetransmitTime();
+}
+
+unsigned short RTCDataChannel::maxRetransmits() const
+{
+    return m_handler->maxRetransmits();
+}
+
+String RTCDataChannel::protocol() const
+{
+    return m_handler->protocol();
+}
+
+bool RTCDataChannel::negotiated() const
+{
+    return m_handler->negotiated();
+}
+
+unsigned short RTCDataChannel::id() const
+{
+    return m_handler->id();
+}
+
 String RTCDataChannel::readyState() const
 {
     switch (m_readyState) {
diff --git a/Source/modules/mediastream/RTCDataChannel.h b/Source/modules/mediastream/RTCDataChannel.h
index fa32551..bee0d04 100644
--- a/Source/modules/mediastream/RTCDataChannel.h
+++ b/Source/modules/mediastream/RTCDataChannel.h
@@ -49,7 +49,16 @@
     ~RTCDataChannel();
 
     String label() const;
+
+    // DEPRECATED
     bool reliable() const;
+
+    bool ordered() const;
+    unsigned short maxRetransmitTime() const;
+    unsigned short maxRetransmits() const;
+    String protocol() const;
+    bool negotiated() const;
+    unsigned short id() const;
     String readyState() const;
     unsigned long bufferedAmount() const;
 
diff --git a/Source/modules/mediastream/RTCDataChannel.idl b/Source/modules/mediastream/RTCDataChannel.idl
index 5abf290..b307d37 100644
--- a/Source/modules/mediastream/RTCDataChannel.idl
+++ b/Source/modules/mediastream/RTCDataChannel.idl
@@ -26,7 +26,17 @@
     NoInterfaceObject
 ] interface RTCDataChannel : EventTarget {
     readonly attribute DOMString label;
+
+    // DEPRECATED
     readonly attribute boolean reliable;
+
+    readonly attribute boolean ordered;
+    readonly attribute unsigned short maxRetransmitTime;
+    readonly attribute unsigned short maxRetransmits;
+    readonly attribute DOMString protocol;
+    readonly attribute boolean negotiated;
+    readonly attribute unsigned short id;
+    
     readonly attribute DOMString readyState;
     readonly attribute unsigned long bufferedAmount;
 
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.cpp
index 91cf2a6..daa3351 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.cpp
@@ -57,6 +57,7 @@
 MockWebRTCDataChannelHandler::MockWebRTCDataChannelHandler(WebString label, const WebRTCDataChannelInit& init, WebTestDelegate* delegate)
     : m_client(0)
     , m_label(label)
+    , m_init(init)
     , m_delegate(delegate)
 {
     m_reliable = (init.ordered && init.maxRetransmits == -1 && init.maxRetransmitTime == -1);
@@ -69,6 +70,36 @@
         m_delegate->postTask(new DataChannelReadyStateTask(this, m_client, WebRTCDataChannelHandlerClient::ReadyStateOpen));
 }
 
+bool MockWebRTCDataChannelHandler::ordered() const
+{
+    return m_init.ordered;
+}
+
+unsigned short MockWebRTCDataChannelHandler::maxRetransmitTime() const
+{
+    return m_init.maxRetransmitTime;
+}
+
+unsigned short MockWebRTCDataChannelHandler::maxRetransmits() const
+{
+    return m_init.maxRetransmits;
+}
+
+WebString MockWebRTCDataChannelHandler::protocol() const
+{
+    return m_init.protocol;
+}
+
+bool MockWebRTCDataChannelHandler::negotiated() const
+{
+    return m_init.negotiated;
+}
+
+unsigned short MockWebRTCDataChannelHandler::id() const
+{
+    return m_init.id;
+}
+
 unsigned long MockWebRTCDataChannelHandler::bufferedAmount()
 {
     return 0;
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.h b/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.h
index e0dea85..c274930 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/MockWebRTCDataChannelHandler.h
@@ -27,13 +27,10 @@
 
 #include "TestCommon.h"
 #include "public/platform/WebRTCDataChannelHandler.h"
+#include "public/platform/WebRTCDataChannelInit.h"
 #include "public/platform/WebString.h"
 #include "public/testing/WebTask.h"
 
-namespace WebKit {
-struct WebRTCDataChannelInit;
-}
-
 namespace WebTestRunner {
 
 class WebTestDelegate;
@@ -45,6 +42,12 @@
     virtual void setClient(WebKit::WebRTCDataChannelHandlerClient*) OVERRIDE;
     virtual WebKit::WebString label() OVERRIDE { return m_label; }
     virtual bool isReliable() OVERRIDE { return m_reliable; }
+    virtual bool ordered() const OVERRIDE;
+    virtual unsigned short maxRetransmitTime() const OVERRIDE;
+    virtual unsigned short maxRetransmits() const OVERRIDE;
+    virtual WebKit::WebString protocol() const OVERRIDE;
+    virtual bool negotiated() const OVERRIDE;
+    virtual unsigned short id() const OVERRIDE;
     virtual unsigned long bufferedAmount() OVERRIDE;
     virtual bool sendStringData(const WebKit::WebString&) OVERRIDE;
     virtual bool sendRawData(const char*, size_t) OVERRIDE;
@@ -58,6 +61,7 @@
 
     WebKit::WebRTCDataChannelHandlerClient* m_client;
     WebKit::WebString m_label;
+    WebKit::WebRTCDataChannelInit m_init;
     bool m_reliable;
     WebTaskList m_taskList;
     WebTestDelegate* m_delegate;
diff --git a/public/platform/WebRTCDataChannelHandler.h b/public/platform/WebRTCDataChannelHandler.h
index 211d8ac..65ad01b 100644
--- a/public/platform/WebRTCDataChannelHandler.h
+++ b/public/platform/WebRTCDataChannelHandler.h
@@ -39,7 +39,17 @@
     virtual void setClient(WebRTCDataChannelHandlerClient*) = 0;
 
     virtual WebString label() = 0;
-    virtual bool isReliable() = 0;
+
+    // DEPRECATED
+    virtual bool isReliable() { return true; }
+
+    virtual bool ordered() const { return false; }
+    virtual unsigned short maxRetransmitTime() const { return 0; }
+    virtual unsigned short maxRetransmits() const { return 0; }
+    virtual WebString protocol() const { return WebString(); }
+    virtual bool negotiated() const { return true; }
+    virtual unsigned short id() const { return 0; }
+
     virtual unsigned long bufferedAmount() = 0;
     virtual bool sendStringData(const WebString&) = 0;
     virtual bool sendRawData(const char*, size_t) = 0;