Bug 147097

Summary: Web Inspector: add protocol test for existing error handling performed by the backend
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Blaze Burg <bburg>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 147096    
Bug Blocks: 147067, 146466    
Attachments:
Description Flags
Proposed Fix joepeck: review+

Brian Burg
Reported 2015-07-19 15:01:22 PDT
Prior to refactoring the error handling, I'd like to get some test coverage.
Attachments
Proposed Fix (30.62 KB, patch)
2015-08-24 16:29 PDT, Blaze Burg
joepeck: review+
Radar WebKit Bug Importer
Comment 1 2015-07-19 15:01:54 PDT
Blaze Burg
Comment 2 2015-08-24 16:29:14 PDT
Created attachment 259790 [details] Proposed Fix
Joseph Pecoraro
Comment 3 2015-08-24 16:46:00 PDT
Comment on attachment 259790 [details] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=259790&action=review Nice! > LayoutTests/inspector/protocol/backend-dispatcher-argument-errors.html:71 > + name : "RequiredParameterWrongType", > + description: "The backend should return an error if a message has an optional parameter with wrong type.", The name here should be "OptionalParameterWrongType". > LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:17 > + let errorCodes = { > + ParseError: -32700, > + InvalidRequest: -32600, > + MethodNotFound: -32601, > + InvalidParams: -32602, > + InternalError: -32603, > + ServerError: -32000, > + }; Should InspectorBackend expose these? Currently it only checks for -32000 but it could expose these constants. Then we wouldn't need to duplicate it in these tests. > LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:39 > + }) Style: semicolon? I'm normally very lax about commenting on style of tests, but seeing a they are getting rather clean / uniform now. > LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:46 > + name : "UnparseableStringMessage", Style: "name :" => "name:" (for all of these in both tests) > LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:141 > + addErrorResponseTestCase({ > + name : "MethodFieldWithBadFormatting5", > + description: "The backend should return an error if a message has a 'method' field not formatted as 'Domain.Methodname'.", > + message: {id: 123, method: ".FooBar."}, > + expectedError: "InvalidRequest" > + }); Another similar one would be Foo.bar.baz. Both covered by the same condition here, but might be good to test separately.
Blaze Burg
Comment 4 2015-08-24 16:55:55 PDT
Comment on attachment 259790 [details] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=259790&action=review >> LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:17 >> + }; > > Should InspectorBackend expose these? Currently it only checks for -32000 but it could expose these constants. Then we wouldn't need to duplicate it in these tests. Meh, they are part of the JSON-RPC specification. Besides, this test doesn't cover InspetorBackend.js, which should be a separate test (focused on correct resolve/reject/callback args). >> LayoutTests/inspector/protocol/backend-dispatcher-malformed-message-errors.html:39 >> + }) > > Style: semicolon? I'm normally very lax about commenting on style of tests, but seeing a they are getting rather clean / uniform now. It's a promise chain.
Blaze Burg
Comment 5 2015-08-24 16:58:56 PDT
Note You need to log in before you can comment on or make changes to this bug.