Web Inspector: add protocol test for existing error handling performed by the backend
https://bugs.webkit.org/show_bug.cgi?id=147097
Reviewed by Joseph Pecoraro.
Source/JavaScriptCore:
A new test revealed that the protocol "method" parameter was being parsed in a naive way.
Rewrite it to use String::split and improve error checking to avoid failing later.
* inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::dispatch):
Source/WebInspectorUI:
Add a way to send raw messages to the backend while still awaiting on responses.
This is necessary to test protocol error handling in the inspector backend.
* UserInterface/Test/InspectorProtocol.js:
(InspectorProtocol.sendCommand):
(InspectorProtocol.awaitCommand): Use awaitMessage internally.
(InspectorProtocol.awaitMessage): Added. Use a dummy requestId if none is supplied.
(InspectorProtocol._sendMessage): Added.
(InspectorProtocol.dispatchMessageFromBackend):
Reject with the error object instead of the error message, so error code/data can be checked.
(InspectorProtocol.sendMessage): Deleted, it is now a private method.
LayoutTests:
Add a bunch of test cases to cover existing error handling by the backend dispatcher.
* inspector/protocol/backend-dispatcher-argument-errors-expected.txt: Added.
* inspector/protocol/backend-dispatcher-argument-errors.html: Added.
* inspector/protocol/backend-dispatcher-malformed-message-errors-expected.txt: Added.
* inspector/protocol/backend-dispatcher-malformed-message-errors.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@188897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
9 files changed