Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html

Issue 444883004: [DevTools] Make inspector-protocol tests work with messages passed as objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 Copyright (C) 2012 Samsung Electronics. All rights reserved. 2 Copyright (C) 2012 Samsung Electronics. All rights reserved.
3 3
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions 5 modification, are permitted provided that the following conditions
6 are met: 6 are met:
7 7
8 1. Redistributions of source code must retain the above copyright 8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright 10 2. Redistributions in binary form must reproduce the above copyright
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 * @param {function({object} messageObject)=} handler 129 * @param {function({object} messageObject)=} handler
130 */ 130 */
131 InspectorTest.sendRawCommand = function(command, handler) 131 InspectorTest.sendRawCommand = function(command, handler)
132 { 132 {
133 this._dispatchTable[++this._requestId] = handler; 133 this._dispatchTable[++this._requestId] = handler;
134 InspectorFrontendHost.sendMessageToBackend(command); 134 InspectorFrontendHost.sendMessageToBackend(command);
135 return this._requestId; 135 return this._requestId;
136 } 136 }
137 137
138 /** 138 /**
139 * @param {string} message 139 * @param {string|!Object} messageOrObject
140 */ 140 */
141 InspectorFrontendAPI.dispatchMessage = function(message) 141 InspectorFrontendAPI.dispatchMessage = function(messageOrObject)
142 { 142 {
143 if (InspectorTest._dumpInspectorProtocolMessages) 143 if (InspectorTest._dumpInspectorProtocolMessages)
144 testRunner.logToStderr("backend: " + message); 144 testRunner.logToStderr("backend: " + (typeof messageOrObject === "string " ? messageOrObject : JSON.stringify(messageOrObject)));
145 var messageObject = JSON.parse(message); 145 var messageObject = (typeof messageOrObject === "string" ? JSON.parse(messag eOrObject) : messageOrObject);
146 var messageId = messageObject["id"]; 146 var messageId = messageObject["id"];
147 try { 147 try {
148 if (typeof messageId === "number") { 148 if (typeof messageId === "number") {
149 var handler = InspectorTest._dispatchTable[messageId]; 149 var handler = InspectorTest._dispatchTable[messageId];
150 if (handler && typeof handler === "function") 150 if (handler && typeof handler === "function")
151 handler(messageObject); 151 handler(messageObject);
152 } else { 152 } else {
153 var eventName = messageObject["method"]; 153 var eventName = messageObject["method"];
154 var eventHandler = InspectorTest.eventHandler[eventName]; 154 var eventHandler = InspectorTest.eventHandler[eventName];
155 if (eventHandler) 155 if (eventHandler)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 function enableInspectorAgent() 317 function enableInspectorAgent()
318 { 318 {
319 InspectorTest.sendCommand("Inspector.enable", { }); 319 InspectorTest.sendCommand("Inspector.enable", { });
320 } 320 }
321 321
322 window.addEventListener("load", enableInspectorAgent, false); 322 window.addEventListener("load", enableInspectorAgent, false);
323 323
324 </script> 324 </script>
325 </head> 325 </head>
326 </html> 326 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698