Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector-protocol / resources / protocol-test.html
index aabbca6..bfd6a99 100644 (file)
@@ -53,7 +53,7 @@ InspectorTest.sendCommand = function(method, params, handler)
                           "id": this._requestId };
 
     if (InspectorTest._dumpInspectorProtocolMessages)
-        testRunner.logToStderr("backend: " + JSON.stringify(messageObject));
+        testRunner.logToStderr("frontend: " + JSON.stringify(messageObject));
     InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
 
     return this._requestId;
@@ -136,13 +136,13 @@ InspectorTest.sendRawCommand = function(command, handler)
 }
 
 /**
- * @param {string} message
+ * @param {string|!Object} messageOrObject
  */
-InspectorFrontendAPI.dispatchMessage = function(message)
+InspectorFrontendAPI.dispatchMessage = function(messageOrObject)
 {
     if (InspectorTest._dumpInspectorProtocolMessages)
-        testRunner.logToStderr("frontend: " + message);
-    var messageObject = JSON.parse(message);
+        testRunner.logToStderr("backend: " + (typeof messageOrObject === "string" ? messageOrObject : JSON.stringify(messageOrObject)));
+    var messageObject = (typeof messageOrObject === "string" ? JSON.parse(messageOrObject) : messageOrObject);
     var messageId = messageObject["id"];
     try {
         if (typeof messageId === "number") {
@@ -156,7 +156,7 @@ InspectorFrontendAPI.dispatchMessage = function(message)
                 eventHandler(messageObject);
         }
     } catch(e) {
-        InspectorTest.log("Exception when dispatching message: " + e + "\n\n message = " + JSON.stringify(messageObject, null, 2));
+        InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stack + "\n message = " + JSON.stringify(messageObject, null, 2));
         InspectorTest.completeTest();
     }
 }
@@ -243,7 +243,7 @@ InspectorTest.completeTest = function()
  * @param {string} message
  * @param {!function} callback
  */
-InspectorTest.executeInPage = function(string, callback)
+InspectorTest.evaluateInPage = function(string, callback)
 {
     this.sendCommand("Runtime.evaluate", { "expression": string }, function(message) {
         if (message.error)