Bug 123205 - Adding mock class to test RTCDataChannelHandler
Summary: Adding mock class to test RTCDataChannelHandler
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 124288
  Show dependency treegraph
 
Reported: 2013-10-23 06:42 PDT by Thiago de Barros Lacerda
Modified: 2013-11-13 11:13 PST (History)
8 users (show)

See Also:


Attachments
Patch (16.29 KB, patch)
2013-10-23 06:53 PDT, Thiago de Barros Lacerda
no flags Details | Formatted Diff | Diff
Patch (16.24 KB, patch)
2013-10-23 14:38 PDT, Thiago de Barros Lacerda
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago de Barros Lacerda 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)
Comment 1 Thiago de Barros Lacerda 2013-10-23 06:53:35 PDT
Created attachment 214955 [details]
Patch
Comment 2 Eric Carlson 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.
Comment 3 Thiago de Barros Lacerda 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
Comment 4 Eric Carlson 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
Comment 5 Thiago de Barros Lacerda 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?
Comment 6 Eric Carlson 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.
Comment 7 Thiago de Barros Lacerda 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 :)
Comment 8 Thiago de Barros Lacerda 2013-10-23 14:38:02 PDT
Created attachment 214998 [details]
Patch
Comment 9 WebKit Commit Bot 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>
Comment 10 WebKit Commit Bot 2013-10-23 15:25:06 PDT
All reviewed patches have been landed.  Closing bug.