4730ae42f44c07758ad22f0e0e74e447dec52f8f
[WebKit-https.git] / LayoutTests / inspector / report-protocol-errors.html
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test2.js"></script>
4 <script>
5
6 function test()
7 {
8     var messages = [
9         'some wrong string',
10         '{}',
11         '{"command":1}',
12         '{"command":"test"}',
13         '{"seq":"not a number","command":"test"}',
14         '{"seq":1,"command":"test"}',
15         '{"seq":2,"command":"resourceContent"}',
16         '{"seq":3,"command":"resourceContent","arguments":[]}',
17         '{"seq":4,"command":"resourceContent","arguments":{}}',
18         '{"seq":5,"command":"resourceContent","arguments":{"identifier":"not a number"}}',
19         '{"seq":6,"command":"removeBreakpoint","arguments":{}}',
20         '{"seq":7,"command":"removeBreakpoint","arguments":{"sourceID":"someSourceId","lineNumber":0}}',
21
22     ];
23     var numberOfReports = 0;
24
25     WebInspector.reportProtocolError = function(message)
26     {
27         if (numberOfReports < messages.length)
28             InspectorTest.addObject(message);
29
30         if (++numberOfReports === messages.length)
31             InspectorTest.completeTest();
32     }
33
34     function fire() {
35         for (var i = 0; i < messages.length; ++i)
36             InspectorFrontendHost.sendMessageToBackend(messages[i]);
37     }
38
39     InspectorBackend.disableDebugger(true, fire);
40 }
41
42 </script>
43 </head>
44
45 <body onload="runTest()">
46 <p>
47 Tests that InspectorBackendDispatcher is catching incorrect messages.
48 </p>
49
50 </body>
51 </html>