Changeset 157808 in webkit
- Timestamp:
- Oct 22, 2013 1:18:36 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 added
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r157766 r157808 1997 1997 platform/mock/GeolocationClientMock.cpp 1998 1998 platform/mock/MockMediaStreamCenter.cpp 1999 platform/mock/RTCNotifiersMock.cpp 2000 platform/mock/RTCPeerConnectionHandlerMock.cpp 1999 2001 platform/mock/ScrollbarThemeMock.cpp 2000 2002 -
trunk/Source/WebCore/ChangeLog
r157807 r157808 1 2013-10-22 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 3 Adding Mock class to test RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=122848 5 6 Reviewed by Eric Carlson. 7 8 The following tests can be run: 9 10 RTCPeerConnection-createAnswer.html 11 RTCPeerConnection-createOffer.html 12 RTCPeerConnection-ice.html 13 RTCPeerConnection-localDescription.html 14 RTCPeerConnection-remoteDescription.html 15 RTCPeerConnection-state.html 16 17 Tests that require a MediaStream object, by invoking getUserMedia, 18 are not ready to run yet. 19 20 No new tests needed. 21 22 * CMakeLists.txt: 23 * platform/mediastream/RTCPeerConnectionHandler.cpp: 24 (WebCore::createHandler): 25 * platform/mediastream/RTCPeerConnectionHandler.h: 26 * platform/mediastream/RTCPeerConnectionHandlerClient.h: 27 * platform/mock/RTCNotifiersMock.cpp: Added. 28 * platform/mock/RTCNotifiersMock.h: Added. 29 * platform/mock/RTCPeerConnectionHandlerMock.cpp: Added. 30 * platform/mock/RTCPeerConnectionHandlerMock.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h. 31 * platform/mock/TimerEventBasedMock.h: Added. 32 * testing/Internals.cpp: 33 (WebCore::Internals::Internals): 34 (WebCore::Internals::enableMockRTCPeerConnectionHandler): 35 * testing/Internals.h: 36 1 37 2013-10-22 Zan Dobersek <zdobersek@igalia.com> 2 38 -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp
r137441 r157808 40 40 class RTCPeerConnectionHandlerClient; 41 41 42 PassOwnPtr<RTCPeerConnectionHandler> RTCPeerConnectionHandler::create(RTCPeerConnectionHandlerClient*)42 static PassOwnPtr<RTCPeerConnectionHandler> createHandler(RTCPeerConnectionHandlerClient*) 43 43 { 44 44 return nullptr; 45 45 } 46 46 47 CreatePeerConnectionHandler RTCPeerConnectionHandler::create = createHandler; 48 47 49 } // namespace WebCore 48 50 -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h
r156473 r157808 46 46 class RTCDataChannelHandler; 47 47 class RTCIceCandidateDescriptor; 48 class RTCPeerConnectionHandler; 48 49 class RTCPeerConnectionHandlerClient; 49 50 class RTCSessionDescriptionDescriptor; … … 68 69 }; 69 70 71 typedef PassOwnPtr<RTCPeerConnectionHandler> (*CreatePeerConnectionHandler)(RTCPeerConnectionHandlerClient*); 72 70 73 class RTCPeerConnectionHandler { 71 74 public: 72 static PassOwnPtr<RTCPeerConnectionHandler> create(RTCPeerConnectionHandlerClient*);75 static CreatePeerConnectionHandler create; 73 76 virtual ~RTCPeerConnectionHandler() { } 74 77 -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h
r146582 r157808 34 34 #if ENABLE(MEDIA_STREAM) 35 35 36 #include <wtf/PassOwnPtr.h> 36 37 #include <wtf/PassRefPtr.h> 37 38 -
trunk/Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.h
r157807 r157808 1 1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved.2 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions 6 6 * are met: 7 *8 7 * 1. Redistributions of source code must retain the above copyright 9 8 * notice, this list of conditions and the following disclaimer. 10 9 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * 3. Neither the name of Google Inc. nor the names of its contributors 15 * may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 17 12 * 18 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 29 24 */ 30 25 31 #ifndef RTCPeerConnectionHandler _h32 #define RTCPeerConnectionHandler _h26 #ifndef RTCPeerConnectionHandlerMock_h 27 #define RTCPeerConnectionHandlerMock_h 33 28 34 29 #if ENABLE(MEDIA_STREAM) 35 30 36 #include " MediaStreamDescriptor.h"37 #include <wtf/PassOwnPtr.h>38 #include <wtf/PassRefPtr.h>31 #include "RTCPeerConnectionHandler.h" 32 #include "RTCSessionDescriptionDescriptor.h" 33 #include "TimerEventBasedMock.h" 39 34 40 35 namespace WebCore { 41 36 42 class MediaConstraints; 43 class MediaStreamSource; 44 class RTCConfiguration; 45 class RTCDTMFSenderHandler; 46 class RTCDataChannelHandler; 47 class RTCIceCandidateDescriptor; 48 class RTCPeerConnectionHandlerClient; 49 class RTCSessionDescriptionDescriptor; 50 class RTCSessionDescriptionRequest; 51 class RTCStatsRequest; 52 class RTCVoidRequest; 53 54 struct RTCDataChannelInit { 55 public: 56 RTCDataChannelInit() 57 : ordered(true) 58 , maxRetransmitTime(-1) 59 , maxRetransmits(-1) 60 , negotiated(false) 61 , id(-1) { } 62 bool ordered; 63 int maxRetransmitTime; 64 int maxRetransmits; 65 String protocol; 66 bool negotiated; 67 int id; 68 }; 69 70 class RTCPeerConnectionHandler { 37 class RTCPeerConnectionHandlerMock FINAL : public RTCPeerConnectionHandler, public TimerEventBasedMock { 71 38 public: 72 39 static PassOwnPtr<RTCPeerConnectionHandler> create(RTCPeerConnectionHandlerClient*); 73 virtual ~RTCPeerConnectionHandler () { }40 virtual ~RTCPeerConnectionHandlerMock() { } 74 41 75 virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) = 0;42 virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 76 43 77 virtual void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) = 0;78 virtual void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) = 0;79 virtual void setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) = 0;80 virtual void setRemoteDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) = 0;81 virtual PassRefPtr<RTCSessionDescriptionDescriptor> localDescription() = 0;82 virtual PassRefPtr<RTCSessionDescriptionDescriptor> remoteDescription() = 0;83 virtual bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) = 0;84 virtual bool addIceCandidate(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCIceCandidateDescriptor>) = 0;85 virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) = 0;86 virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) = 0;87 virtual void getStats(PassRefPtr<RTCStatsRequest>) = 0;88 virtual PassOwnPtr<RTCDataChannelHandler> createDataChannel(const String& label, const RTCDataChannelInit&) = 0;89 virtual PassOwnPtr<RTCDTMFSenderHandler> createDTMFSender(PassRefPtr<MediaStreamSource>) = 0;90 virtual void stop() = 0;44 virtual void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE; 45 virtual void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>) OVERRIDE; 46 virtual void setLocalDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE; 47 virtual void setRemoteDescription(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCSessionDescriptionDescriptor>) OVERRIDE; 48 virtual PassRefPtr<RTCSessionDescriptionDescriptor> localDescription() OVERRIDE; 49 virtual PassRefPtr<RTCSessionDescriptionDescriptor> remoteDescription() OVERRIDE; 50 virtual bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 51 virtual bool addIceCandidate(PassRefPtr<RTCVoidRequest>, PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE; 52 virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) OVERRIDE; 53 virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE; 54 virtual void getStats(PassRefPtr<RTCStatsRequest>) OVERRIDE; 55 virtual PassOwnPtr<RTCDataChannelHandler> createDataChannel(const String& label, const RTCDataChannelInit&) OVERRIDE; 56 virtual PassOwnPtr<RTCDTMFSenderHandler> createDTMFSender(PassRefPtr<MediaStreamSource>) OVERRIDE; 57 virtual void stop() OVERRIDE; 91 58 92 59 protected: 93 RTCPeerConnectionHandler() { } 60 RTCPeerConnectionHandlerMock(RTCPeerConnectionHandlerClient*); 61 62 private: 63 RTCPeerConnectionHandlerClient* m_client; 64 65 RefPtr<RTCSessionDescriptionDescriptor> m_localSessionDescription; 66 RefPtr<RTCSessionDescriptionDescriptor> m_remoteSessionDescription; 94 67 }; 95 68 … … 98 71 #endif // ENABLE(MEDIA_STREAM) 99 72 100 #endif // RTCPeerConnectionHandler _h73 #endif // RTCPeerConnectionHandlerMock_h -
trunk/Source/WebCore/testing/Internals.cpp
r157702 r157808 149 149 #if ENABLE(MEDIA_STREAM) 150 150 #include "MockMediaStreamCenter.h" 151 #include "RTCPeerConnection.h" 152 #include "RTCPeerConnectionHandlerMock.h" 151 153 #endif 152 154 … … 281 283 document->page()->group().captionPreferences()->setTestingMode(true); 282 284 #endif 283 285 284 286 #if ENABLE(MEDIA_STREAM) 285 287 MockMediaStreamCenter::registerMockMediaStreamCenter(); 288 enableMockRTCPeerConnectionHandler(); 286 289 #endif 287 290 } … … 645 648 } 646 649 #endif 647 650 651 #if ENABLE(MEDIA_STREAM) 652 void Internals::enableMockRTCPeerConnectionHandler() 653 { 654 RTCPeerConnectionHandler::create = RTCPeerConnectionHandlerMock::create; 655 } 656 #endif 657 648 658 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec) 649 659 { -
trunk/Source/WebCore/testing/Internals.h
r157361 r157808 294 294 #endif 295 295 296 #if ENABLE(MEDIA_STREAM) 297 void enableMockRTCPeerConnectionHandler(); 298 #endif 299 296 300 String getImageSourceURL(Element*, ExceptionCode&); 297 301
Note: See TracChangeset
for help on using the changeset viewer.