WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
169175
Web Inspector: Add tests for webSocketFrameSent and webSocketFrameReceived
https://bugs.webkit.org/show_bug.cgi?id=169175
Summary
Web Inspector: Add tests for webSocketFrameSent and webSocketFrameReceived
Nikita Vasilyev
Reported
2017-03-04 14:46:06 PST
NetworkObserver#webSocketFrameReceived and NetworkObserver#webSocketFrameSent were implemented in
Bug 167520
: Web Inspector: Show Web Socket connections in Network tab. These two methods are currently untested.
Attachments
Patch
(12.88 KB, patch)
2017-04-06 12:36 PDT
,
Nikita Vasilyev
joepeck
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-03-04 14:46:25 PST
<
rdar://problem/30853154
>
Nikita Vasilyev
Comment 2
2017-04-06 12:36:33 PDT
Created
attachment 306409
[details]
Patch
Joseph Pecoraro
Comment 3
2017-04-06 14:16:33 PDT
Comment on
attachment 306409
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=306409&action=review
The tests looks good but I want to see updated versions addressing most of my comments. Is there a test for `webSocketFrameError` in the works?
> LayoutTests/ChangeLog:9 > + Test recieving and sending text and binary (blob and array buffer) data.
Typo: recieving
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt:4 > +== Running test suite: WebSocket.Binary
Do we have the size of the binary message? I think that would be useful.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt:17 > +PASS: Message walltime is greater than the first one.
A stricter test could check that the time is greater than the last message, not the first message.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:11 > + setTimeout(() => webSocket.close(), 500);
A timeout of 500ms could cause this to be flakey. I'd suggest something like: // Global variable to keep it alive. let webSocket = null; function createWebSocket(type) { closeWebSocketConnection(); webSocket = new WebSocket(...); webSocket.binaryType = type; } function closeWebSocketConnection() { if (webSocket) { webSocket.close(); webSocket = null; } } And at the end of `resourceWasAdded` before calling resolve you can evaluateInPage(`closeWebSocketConnection()`) to clean up if you want.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:53 > + setTimeout(() => reject(), 500);
This will likely cause the test to be flakey. I'd suggest just dropping it.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:58 > + description: "WebInspector.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the client.",
This description doesn't match the test.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:61 > +
Nit: Drop this empty line.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:62 > + InspectorTest.evaluateInPage("createWebSocketConnection(\"blob\")");
Style: What I've tended to do is to use template strings for code, which eliminates tedious escaping of quotes and it makes code strings appear differently in good editors. So you would have: `createWebSocketConnection("blob")`
> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html:68 > + description: "WebInspector.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the client.",
This description doesn't match the test.
> LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive-expected.txt:7 > +PASS: Message is a text type.
If its text we can show it!
> LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html:27 > + description: "WebInspector.WebSocketResource.Event.ReadyStateChanged events are fired in order when WebSocket connection is closed by the client.",
This description does not match the test.
Nikita Vasilyev
Comment 4
2017-04-06 16:52:27 PDT
(In reply to Joseph Pecoraro from
comment #3
)
> Comment on
attachment 306409
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=306409&action=review
> > The tests looks good but I want to see updated versions addressing most of > my comments. > > Is there a test for `webSocketFrameError` in the works?
Yes. It's more complicated since there're many reasons a connection may fail. I'm planning on adding webSocketFrameError tests at the same time as the UI for displaying these errors in WebSocketContentView, separately from this patch.
Joseph Pecoraro
Comment 5
2017-04-06 20:15:16 PDT
> Yes. It's more complicated since there're many reasons a connection may > fail. I'm planning on adding webSocketFrameError tests at the same time as > the UI for displaying these errors in WebSocketContentView, separately from > this patch.
Okay! Can you point me to the bug covering that? Thanks
Nikita Vasilyev
Comment 6
2017-04-07 10:58:04 PDT
(In reply to Joseph Pecoraro from
comment #5
)
> > Yes. It's more complicated since there're many reasons a connection may > > fail. I'm planning on adding webSocketFrameError tests at the same time as > > the UI for displaying these errors in WebSocketContentView, separately from > > this patch. > > Okay! Can you point me to the bug covering that? Thanks
<
rdar://problem/31389605
>
Nikita Vasilyev
Comment 7
2017-04-07 18:38:59 PDT
Comment on
attachment 306409
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=306409&action=review
>> LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt:4 >> +== Running test suite: WebSocket.Binary > > Do we have the size of the binary message? I think that would be useful.
Yes, but it was incorrect.
Bug 170609
- Web Inspector: WebSockets: Transferred size is incorrect.
Blaze Burg
Comment 8
2017-04-10 13:07:15 PDT
<
rdar://problem/30853154
>
Nikita Vasilyev
Comment 9
2017-04-12 15:39:07 PDT
Comment on
attachment 306409
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=306409&action=review
>> LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive-expected.txt:7 >> +PASS: Message is a text type. > > If its text we can show it!
I'm not sure what you're suggesting. InspectorTest.expectEqual(frame.opcode, WebInspector.WebSocketResource.OpCodes.TextFrame, frame.data); ?
Joseph Pecoraro
Comment 10
2017-04-12 18:06:43 PDT
(In reply to Nikita Vasilyev from
comment #9
)
> Comment on
attachment 306409
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=306409&action=review
> > >> LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive-expected.txt:7 > >> +PASS: Message is a text type. > > > > If its text we can show it! > > I'm not sure what you're suggesting. > > InspectorTest.expectEqual(frame.opcode, > WebInspector.WebSocketResource.OpCodes.TextFrame, frame.data); > > ?
InspectorTest.expectEqual(frame.opcode, OpCodes.TextFrame, "Frame should be text"); InspectorTest.expectEqual(frame.data, "Hello world", "Frame data should be 'Hello world'");
Nikita Vasilyev
Comment 11
2017-04-14 23:56:15 PDT
Fixed in
https://trac.webkit.org/changeset/215388/webkit
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug