Changeset 157892 in webkit
- Timestamp:
- Oct 23, 2013 3:26:42 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r157889 r157892 1 2013-10-23 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 3 Adding mock class to test RTCDataChannelHandler 4 https://bugs.webkit.org/show_bug.cgi?id=123205 5 6 Reviewed by Eric Carlson. 7 8 The reliable property was removed in the spec 9 10 * fast/mediastream/RTCPeerConnection-datachannel-expected.txt: 11 * fast/mediastream/RTCPeerConnection-datachannel.html: 12 1 13 2013-10-23 Bem Jones-Bey <bjonesbe@adobe.com> 2 14 -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel-expected.txt
r155794 r157892 5 5 6 6 PASS dc = pc.createDataChannel("label1"); did not throw exception. 7 PASS dc.reliable is true8 7 PASS dc = pc.createDataChannel("label2", {}); did not throw exception. 9 PASS dc.reliable is true10 8 PASS dc = pc.createDataChannel("label3", {ordered:true}); did not throw exception. 11 PASS dc.reliable is true12 9 PASS dc = pc.createDataChannel("label3", {ordered:false}); did not throw exception. 13 PASS dc.reliable is false14 10 PASS dc = pc.createDataChannel("label3", {maxRetransmits:0}); did not throw exception. 15 PASS dc.reliable is false16 11 PASS dc = pc.createDataChannel("label3", {maxRetransmitTime:0}); did not throw exception. 17 PASS dc.reliable is false18 12 PASS pc is connected 19 13 PASS dc = pc.createDataChannel("label"); did not throw exception. -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html
r155794 r157892 84 84 pc = new webkitRTCPeerConnection(null, null); 85 85 shouldNotThrow('dc = pc.createDataChannel("label1");'); 86 shouldBe("dc.reliable", "true");87 86 shouldNotThrow('dc = pc.createDataChannel("label2", {});'); 88 shouldBe("dc.reliable", "true");89 87 shouldNotThrow('dc = pc.createDataChannel("label3", {ordered:true});'); 90 shouldBe("dc.reliable", "true");91 88 shouldNotThrow('dc = pc.createDataChannel("label3", {ordered:false});'); 92 shouldBe("dc.reliable", "false");93 89 shouldNotThrow('dc = pc.createDataChannel("label3", {maxRetransmits:0});'); 94 shouldBe("dc.reliable", "false");95 90 shouldNotThrow('dc = pc.createDataChannel("label3", {maxRetransmitTime:0});'); 96 shouldBe("dc.reliable", "false");97 91 98 92 pc = new webkitRTCPeerConnection(null, null); -
trunk/Source/WebCore/CMakeLists.txt
r157869 r157892 1997 1997 platform/mock/GeolocationClientMock.cpp 1998 1998 platform/mock/MockMediaStreamCenter.cpp 1999 platform/mock/RTCDataChannelHandlerMock.cpp 1999 2000 platform/mock/RTCNotifiersMock.cpp 2000 2001 platform/mock/RTCPeerConnectionHandlerMock.cpp -
trunk/Source/WebCore/ChangeLog
r157890 r157892 1 2013-10-23 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 3 Adding mock class to test RTCDataChannelHandler 4 https://bugs.webkit.org/show_bug.cgi?id=123205 5 6 Reviewed by Eric Carlson. 7 8 Now RTCPeerConnectionHandler-datachannel LayouTest can run properly. 9 Also updated the expected file, removing the reliable property check (which was removed in the spec) 10 11 Existing tests updated. 12 13 * CMakeLists.txt: 14 * platform/mediastream/RTCDataChannelHandlerClient.h: 15 * platform/mock/RTCDataChannelHandlerMock.cpp: Added. 16 * platform/mock/RTCDataChannelHandlerMock.h: Added. 17 * platform/mock/RTCNotifiersMock.cpp: 18 (WebCore::RemoteDataChannelNotifier::RemoteDataChannelNotifier): 19 (WebCore::RemoteDataChannelNotifier::fire): 20 (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): 21 (WebCore::DataChannelStateNotifier::fire): 22 * platform/mock/RTCNotifiersMock.h: 23 * platform/mock/RTCPeerConnectionHandlerMock.cpp: 24 (WebCore::RTCPeerConnectionHandlerMock::createDataChannel): 25 1 26 2013-10-23 Andreas Kling <akling@apple.com> 2 27 -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h
r137441 r157892 28 28 #if ENABLE(MEDIA_STREAM) 29 29 30 #include <wtf/text/WTFString.h> 31 30 32 namespace WebCore { 31 33 -
trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp
r157891 r157892 28 28 #if ENABLE(MEDIA_STREAM) 29 29 30 #include "RTCDataChannelHandlerMock.h" 31 32 #include "RTCDataChannelHandlerClient.h" 30 33 #include "RTCNotifiersMock.h" 31 32 #include "RTCSessionDescriptionDescriptor.h"33 #include "RTCSessionDescriptionRequest.h"34 #include "RTCVoidRequest.h"35 34 36 35 namespace WebCore { 37 36 38 SessionRequestNotifier::SessionRequestNotifier(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<RTCSessionDescriptionDescriptor> descriptor) 39 : m_request(request) 40 , m_descriptor(descriptor) 37 RTCDataChannelHandlerMock::RTCDataChannelHandlerMock(const String& label, const RTCDataChannelInit& init) 38 : m_label(label) 39 , m_protocol(init.protocol) 40 , m_maxRetransmitTime(init.maxRetransmitTime) 41 , m_maxRetransmits(init.maxRetransmits) 42 , m_id(init.id) 43 , m_ordered(init.ordered) 44 , m_negotiated(init.negotiated) 41 45 { 42 46 } 43 47 44 void SessionRequestNotifier::fire()48 void RTCDataChannelHandlerMock::setClient(RTCDataChannelHandlerClient* client) 45 49 { 46 if (m_descriptor) 47 m_request->requestSucceeded(m_descriptor); 48 else 49 m_request->requestFailed("TEST_ERROR"); 50 if (!client) 51 return; 52 53 m_client = client; 54 RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateOpen)); 55 m_timerEvents.append(adoptRef(new TimerEvent(this, notifier))); 50 56 } 51 57 52 VoidRequestNotifier::VoidRequestNotifier(PassRefPtr<RTCVoidRequest> request, bool success) 53 : m_request(request) 54 , m_success(success) 58 bool RTCDataChannelHandlerMock::sendStringData(const String& string) 55 59 { 60 m_client->didReceiveStringData(string); 61 return true; 56 62 } 57 63 58 void VoidRequestNotifier::fire()64 bool RTCDataChannelHandlerMock::sendRawData(const char* data, size_t size) 59 65 { 60 if (m_success) 61 m_request->requestSucceeded(); 62 else 63 m_request->requestFailed("TEST_ERROR"); 66 m_client->didReceiveRawData(data, size); 67 return true; 64 68 } 65 69 66 IceConnectionNotifier::IceConnectionNotifier(RTCPeerConnectionHandlerClient* client, RTCPeerConnectionHandlerClient::IceConnectionState connectionState, RTCPeerConnectionHandlerClient::IceGatheringState gatheringState) 67 : m_client(client) 68 , m_connectionState(connectionState) 69 , m_gatheringState(gatheringState) 70 void RTCDataChannelHandlerMock::close() 70 71 { 71 } 72 73 void IceConnectionNotifier::fire() 74 { 75 m_client->didChangeIceGatheringState(m_gatheringState); 76 m_client->didChangeIceConnectionState(m_connectionState); 72 RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateClosed)); 73 m_timerEvents.append(adoptRef(new TimerEvent(this, notifier))); 77 74 } 78 75 -
trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h
r157891 r157892 24 24 */ 25 25 26 #ifndef RTC NotifiersMock_h27 #define RTC NotifiersMock_h26 #ifndef RTCDataChannelHandlerMock_h 27 #define RTCDataChannelHandlerMock_h 28 28 29 29 #if ENABLE(MEDIA_STREAM) 30 30 31 #include "RTCPeerConnectionHandlerClient.h" 31 #include "RTCDataChannelHandler.h" 32 #include "RTCPeerConnectionHandler.h" 32 33 #include "TimerEventBasedMock.h" 33 #include <wtf/PassRefPtr.h>34 #include <wtf/RefPtr.h>35 34 36 35 namespace WebCore { 37 36 38 class RTCSessionDescriptionDescriptor; 39 class RTCSessionDescriptionRequest; 40 class RTCVoidRequest; 37 class RTCDataChannelHandlerMock FINAL : public RTCDataChannelHandler, public TimerEventBasedMock { 38 public: 39 RTCDataChannelHandlerMock(const String&, const RTCDataChannelInit&); 40 virtual ~RTCDataChannelHandlerMock() { } 41 41 42 class SessionRequestNotifier : public MockNotifier { 43 public: 44 SessionRequestNotifier(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>); 42 virtual void setClient(RTCDataChannelHandlerClient*) OVERRIDE; 45 43 46 void fire() OVERRIDE; 44 virtual String label() OVERRIDE { return m_label; } 45 virtual bool ordered() OVERRIDE { return m_ordered; } 46 virtual unsigned short maxRetransmitTime() OVERRIDE { return m_maxRetransmitTime; } 47 virtual unsigned short maxRetransmits() OVERRIDE { return m_maxRetransmits; } 48 virtual String protocol() OVERRIDE { return m_protocol; } 49 virtual bool negotiated() OVERRIDE { return m_negotiated; } 50 virtual unsigned short id() OVERRIDE { return m_id; } 51 virtual unsigned long bufferedAmount() OVERRIDE { return 0; } 52 53 virtual bool sendStringData(const String&) OVERRIDE; 54 virtual bool sendRawData(const char*, size_t) OVERRIDE; 55 virtual void close() OVERRIDE; 47 56 48 57 private: 49 RefPtr<RTCSessionDescriptionRequest> m_request; 50 RefPtr<RTCSessionDescriptionDescriptor> m_descriptor; 51 }; 58 RTCDataChannelHandlerClient* m_client; 52 59 53 class VoidRequestNotifier : public MockNotifier { 54 public: 55 VoidRequestNotifier(PassRefPtr<RTCVoidRequest>, bool); 56 57 void fire() OVERRIDE; 58 59 private: 60 RefPtr<RTCVoidRequest> m_request; 61 bool m_success; 62 }; 63 64 class IceConnectionNotifier : public MockNotifier { 65 public: 66 IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCPeerConnectionHandlerClient::IceConnectionState, RTCPeerConnectionHandlerClient::IceGatheringState); 67 68 void fire() OVERRIDE; 69 70 private: 71 RTCPeerConnectionHandlerClient* m_client; 72 RTCPeerConnectionHandlerClient::IceConnectionState m_connectionState; 73 RTCPeerConnectionHandlerClient::IceGatheringState m_gatheringState; 60 String m_label; 61 String m_protocol; 62 unsigned short m_maxRetransmitTime; 63 unsigned short m_maxRetransmits; 64 unsigned short m_id; 65 bool m_ordered; 66 bool m_negotiated; 74 67 }; 75 68 … … 78 71 #endif // ENABLE(MEDIA_STREAM) 79 72 80 #endif // RTC NotifiersMock_h73 #endif // RTCDataChannelHandlerMock_h -
trunk/Source/WebCore/platform/mock/RTCNotifiersMock.cpp
r157808 r157892 30 30 #include "RTCNotifiersMock.h" 31 31 32 #include "RTCDataChannelHandlerMock.h" 32 33 #include "RTCSessionDescriptionDescriptor.h" 33 34 #include "RTCSessionDescriptionRequest.h" … … 77 78 } 78 79 80 RemoteDataChannelNotifier::RemoteDataChannelNotifier(RTCPeerConnectionHandlerClient* client) 81 : m_client(client) 82 { 83 } 84 85 void RemoteDataChannelNotifier::fire() 86 { 87 m_client->didAddRemoteDataChannel(adoptPtr(new RTCDataChannelHandlerMock("RTCDataChannelHandlerMock", RTCDataChannelInit()))); 88 } 89 90 DataChannelStateNotifier::DataChannelStateNotifier(RTCDataChannelHandlerClient* client, RTCDataChannelHandlerClient::ReadyState state) 91 : m_client(client) 92 , m_state(state) 93 { 94 } 95 96 void DataChannelStateNotifier::fire() 97 { 98 m_client->didChangeReadyState(m_state); 99 } 100 79 101 } // namespace WebCore 80 102 -
trunk/Source/WebCore/platform/mock/RTCNotifiersMock.h
r157808 r157892 29 29 #if ENABLE(MEDIA_STREAM) 30 30 31 #include "RTCDataChannelHandlerClient.h" 31 32 #include "RTCPeerConnectionHandlerClient.h" 32 33 #include "TimerEventBasedMock.h" … … 74 75 }; 75 76 77 class RemoteDataChannelNotifier : public MockNotifier { 78 public: 79 RemoteDataChannelNotifier(RTCPeerConnectionHandlerClient*); 80 81 void fire() OVERRIDE; 82 83 private: 84 RTCPeerConnectionHandlerClient* m_client; 85 }; 86 87 class DataChannelStateNotifier : public MockNotifier { 88 public: 89 DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelHandlerClient::ReadyState); 90 91 void fire() OVERRIDE; 92 93 private: 94 RTCDataChannelHandlerClient* m_client; 95 RTCDataChannelHandlerClient::ReadyState m_state; 96 }; 97 76 98 } // namespace WebCore 77 99 -
trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp
r157808 r157892 33 33 #include "RTCDTMFSenderHandler.h" 34 34 #include "RTCDataChannelHandler.h" 35 #include "RTCDataChannelHandlerMock.h" 35 36 #include "RTCNotifiersMock.h" 36 37 #include "RTCSessionDescriptionRequest.h" … … 153 154 } 154 155 155 PassOwnPtr<RTCDataChannelHandler> RTCPeerConnectionHandlerMock::createDataChannel(const String& , const RTCDataChannelInit&)156 PassOwnPtr<RTCDataChannelHandler> RTCPeerConnectionHandlerMock::createDataChannel(const String& label, const RTCDataChannelInit& init) 156 157 { 157 // Requires a mock implementation of RTCDataChannelHandler. 158 // This must be implemented once the mock implementation of RTCDataChannelHandler is ready. 159 notImplemented(); 160 return 0; 158 RefPtr<RemoteDataChannelNotifier> notifier = adoptRef(new RemoteDataChannelNotifier(m_client)); 159 m_timerEvents.append(adoptRef(new TimerEvent(this, notifier))); 160 return adoptPtr(new RTCDataChannelHandlerMock(label, init)); 161 161 } 162 162
Note: See TracChangeset
for help on using the changeset viewer.