RESOLVED FIXED 123205
Adding mock class to test RTCDataChannelHandler
https://bugs.webkit.org/show_bug.cgi?id=123205
Summary Adding mock class to test RTCDataChannelHandler
Thiago de Barros Lacerda
Reported 2013-10-23 06:42:31 PDT
Now RTCPeerConnectionHandler-datachannel LayouTest can run properly. Also updated the expected file, removing the reliable property check (which was removed in the spec)
Attachments
Patch (16.29 KB, patch)
2013-10-23 06:53 PDT, Thiago de Barros Lacerda
no flags
Patch (16.24 KB, patch)
2013-10-23 14:38 PDT, Thiago de Barros Lacerda
no flags
Thiago de Barros Lacerda
Comment 1 2013-10-23 06:53:35 PDT
Eric Carlson
Comment 2 2013-10-23 10:18:53 PDT
Comment on attachment 214955 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214955&action=review > Source/WebCore/ChangeLog:11 > + No new tests needed. I would say "Existing tests updated" instead. > Source/WebCore/ChangeLog:16 > + * platform/mock/RTCDataChannelHandlerMock.cpp: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.cpp. > + * platform/mock/RTCDataChannelHandlerMock.h: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.h. Are these "Copied from" comments correct? > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:51 > + String label() OVERRIDE { return m_label; } > + bool ordered() OVERRIDE { return m_ordered; } > + unsigned short maxRetransmitTime() OVERRIDE { return m_maxRetransmitTime; } > + unsigned short maxRetransmits() OVERRIDE { return m_maxRetransmits; } > + String protocol() OVERRIDE { return m_protocol; } > + bool negotiated() OVERRIDE { return m_negotiated; } > + unsigned short id() OVERRIDE { return m_id; } > + unsigned long bufferedAmount() OVERRIDE { return 0; } These should all be virtual. > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:66 > + String m_label; > + bool m_ordered; > + unsigned short m_maxRetransmitTime; > + unsigned short m_maxRetransmits; > + String m_protocol; > + bool m_negotiated; > + unsigned short m_id; Nit: it may be slightly more space efficient to have the "short" and "bool" members last.
Thiago de Barros Lacerda
Comment 3 2013-10-23 10:23:36 PDT
(In reply to comment #2) > (From update of attachment 214955 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=214955&action=review > > > Source/WebCore/ChangeLog:11 > > + No new tests needed. > > I would say "Existing tests updated" instead. > > > Source/WebCore/ChangeLog:16 > > + * platform/mock/RTCDataChannelHandlerMock.cpp: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.cpp. > > + * platform/mock/RTCDataChannelHandlerMock.h: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.h. > > Are these "Copied from" comments correct? Git thinks that I copied them, maybe because of its similarity check. But I didn't not copy. Should I remove them? > > > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:51 > > + String label() OVERRIDE { return m_label; } > > + bool ordered() OVERRIDE { return m_ordered; } > > + unsigned short maxRetransmitTime() OVERRIDE { return m_maxRetransmitTime; } > > + unsigned short maxRetransmits() OVERRIDE { return m_maxRetransmits; } > > + String protocol() OVERRIDE { return m_protocol; } > > + bool negotiated() OVERRIDE { return m_negotiated; } > > + unsigned short id() OVERRIDE { return m_id; } > > + unsigned long bufferedAmount() OVERRIDE { return 0; } > > These should all be virtual. Why? The class is final, so no class can use it as superclass and override its methods. > > > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:66 > > + String m_label; > > + bool m_ordered; > > + unsigned short m_maxRetransmitTime; > > + unsigned short m_maxRetransmits; > > + String m_protocol; > > + bool m_negotiated; > > + unsigned short m_id; > > Nit: it may be slightly more space efficient to have the "short" and "bool" members last. OK
Eric Carlson
Comment 4 2013-10-23 10:36:45 PDT
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 214955 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=214955&action=review > > > > > Source/WebCore/ChangeLog:11 > > > + No new tests needed. > > > > I would say "Existing tests updated" instead. > > > > > Source/WebCore/ChangeLog:16 > > > + * platform/mock/RTCDataChannelHandlerMock.cpp: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.cpp. > > > + * platform/mock/RTCDataChannelHandlerMock.h: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.h. > > > > Are these "Copied from" comments correct? > > Git thinks that I copied them, maybe because of its similarity check. But I didn't not copy. Should I remove them? > > I would remove the comments because they are incorrect. > > > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:51 > > > + String label() OVERRIDE { return m_label; } > > > + bool ordered() OVERRIDE { return m_ordered; } > > > + unsigned short maxRetransmitTime() OVERRIDE { return m_maxRetransmitTime; } > > > + unsigned short maxRetransmits() OVERRIDE { return m_maxRetransmits; } > > > + String protocol() OVERRIDE { return m_protocol; } > > > + bool negotiated() OVERRIDE { return m_negotiated; } > > > + unsigned short id() OVERRIDE { return m_id; } > > > + unsigned long bufferedAmount() OVERRIDE { return 0; } > > > > These should all be virtual. > > Why? The class is final, so no class can use it as superclass and override its methods. > Oops :-O
Thiago de Barros Lacerda
Comment 5 2013-10-23 10:39:28 PDT
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > (From update of attachment 214955 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=214955&action=review > > > > > > > Source/WebCore/ChangeLog:11 > > > > + No new tests needed. > > > > > > I would say "Existing tests updated" instead. > > > > > > > Source/WebCore/ChangeLog:16 > > > > + * platform/mock/RTCDataChannelHandlerMock.cpp: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.cpp. > > > > + * platform/mock/RTCDataChannelHandlerMock.h: Copied from Source/WebCore/platform/mock/RTCNotifiersMock.h. > > > > > > Are these "Copied from" comments correct? > > > > Git thinks that I copied them, maybe because of its similarity check. But I didn't not copy. Should I remove them? > > > > > I would remove the comments because they are incorrect. > > > > > Source/WebCore/platform/mock/RTCDataChannelHandlerMock.h:51 > > > > + String label() OVERRIDE { return m_label; } > > > > + bool ordered() OVERRIDE { return m_ordered; } > > > > + unsigned short maxRetransmitTime() OVERRIDE { return m_maxRetransmitTime; } > > > > + unsigned short maxRetransmits() OVERRIDE { return m_maxRetransmits; } > > > > + String protocol() OVERRIDE { return m_protocol; } > > > > + bool negotiated() OVERRIDE { return m_negotiated; } > > > > + unsigned short id() OVERRIDE { return m_id; } > > > > + unsigned long bufferedAmount() OVERRIDE { return 0; } > > > > > > These should all be virtual. > > > > Why? The class is final, so no class can use it as superclass and override its methods. > > > > Oops :-O By looking at the webkit source, I could notice that they put the virtual keyword anyway, maybe is it a style? Should I add virtual?
Eric Carlson
Comment 6 2013-10-23 10:43:46 PDT
(In reply to comment #5) > By looking at the webkit source, I could notice that they put the virtual keyword anyway, maybe is it a style? Should I add virtual? I think so. It is slightly pedantic, but I think it makes it more obvious and it what is typically done in WebKit.
Thiago de Barros Lacerda
Comment 7 2013-10-23 10:51:11 PDT
(In reply to comment #6) > (In reply to comment #5) > > By looking at the webkit source, I could notice that they put the virtual keyword anyway, maybe is it a style? Should I add virtual? > > I think so. It is slightly pedantic, but I think it makes it more obvious and it what is typically done in WebKit. np :)
Thiago de Barros Lacerda
Comment 8 2013-10-23 14:38:02 PDT
WebKit Commit Bot
Comment 9 2013-10-23 15:25:04 PDT
Comment on attachment 214998 [details] Patch Clearing flags on attachment: 214998 Committed r157892: <http://trac.webkit.org/changeset/157892>
WebKit Commit Bot
Comment 10 2013-10-23 15:25:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.