X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FLayoutTests%2Fhttp%2Ftests%2Finspector%2Finspector-test.js;h=badd7ee3dc07e0f77fb9afe467ebfc8bcc11d26c;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=4c687ea0311f7b22bbc5adea9a786d7181c2cc40;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js b/src/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js index 4c687ea..badd7ee 100644 --- a/src/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js +++ b/src/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js @@ -36,12 +36,6 @@ InspectorTest.Output = { // override in window.initialize_yourName } }; -InspectorTest.toViewMessage = function(message) -{ - WebInspector.inspectorView.panel("console"); - return WebInspector.ConsolePanel._view()._messageToViewMessage.get(message); -} - InspectorTest.completeTest = function() { InspectorTest.Output.testComplete(); @@ -54,13 +48,13 @@ InspectorTest.evaluateInConsole = function(code, callback) WebInspector.inspectorView.panel("console"); var consoleView = WebInspector.ConsolePanel._view(); consoleView.visible = true; - consoleView.prompt.text = code; + consoleView._prompt.text = code; var event = document.createEvent("KeyboardEvent"); event.initKeyboardEvent("keydown", true, true, null, "Enter", ""); - consoleView.prompt.proxyElement.dispatchEvent(event); + consoleView._prompt.proxyElement.dispatchEvent(event); InspectorTest.addConsoleSniffer( function(commandResult) { - callback(InspectorTest.toViewMessage(commandResult).toMessageElement().textContent); + callback(commandResult.toMessageElement().textContent); }); } @@ -83,7 +77,7 @@ InspectorTest.evaluateInPage = function(code, callback) function mycallback(error, result, wasThrown) { if (!error) - callback(WebInspector.RemoteObject.fromPayload(result), wasThrown); + callback(WebInspector.runtimeModel.createRemoteObject(result), wasThrown); } RuntimeAgent.evaluate(code, "console", false, mycallback); } @@ -93,6 +87,35 @@ InspectorTest.evaluateInPageWithTimeout = function(code) InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'))"); } +var lastEvalId = 0; +var pendingEvalRequests = {}; + +InspectorTest.invokePageFunctionAsync = function(functionName, callback) +{ + var id = ++lastEvalId; + pendingEvalRequests[id] = InspectorTest.safeWrap(callback); + var asyncEvalWrapper = function(callId, functionName) + { + function evalCallback(result) + { + testRunner.evaluateInWebInspector(evalCallbackCallId, "InspectorTest.didInvokePageFunctionAsync(" + callId + ", " + JSON.stringify(result) + ");"); + } + eval(functionName + "(" + evalCallback + ")"); + } + InspectorTest.evaluateInPage("(" + asyncEvalWrapper.toString() + ")(" + id + ", unescape('" + escape(functionName) + "'))"); +} + +InspectorTest.didInvokePageFunctionAsync = function(callId, value) +{ + var callback = pendingEvalRequests[callId]; + if (!callback) { + InspectorTest.addResult("Missing callback for ascyn eval " + callId + ", perhaps callback invoked twice?"); + return; + } + delete pendingEvalRequests[callId]; + callback(value); +} + InspectorTest.check = function(passCondition, failureText) { if (!passCondition) @@ -120,15 +143,12 @@ InspectorTest.addResults = function(textArray) InspectorTest.addResult(textArray[i]); } -function onError(event) +window.onerror = function (message, filename, lineno, colno, error) { - window.removeEventListener("error", onError); - InspectorTest.addResult("Uncaught exception in inspector front-end: " + event.message + " [" + event.filename + ":" + event.lineno + "]"); + InspectorTest.addResult("Uncaught exception in inspector front-end: " + message + " [" + error.stack + "]"); InspectorTest.completeTest(); } -window.addEventListener("error", onError); - InspectorTest.formatters = {}; InspectorTest.formatters.formatAsTypeName = function(value) @@ -367,8 +387,7 @@ InspectorTest.addSniffer = function(receiver, methodName, override, opt_sticky) InspectorTest.addConsoleSniffer = function(override, opt_sticky) { var sniffer = function (viewMessage) { - var message = viewMessage.consoleMessage(); - override(message); + override(viewMessage); }; WebInspector.inspectorView.panel("console"); @@ -551,6 +570,7 @@ WebInspector.TempFile = InspectorTest.TempFileMock; var initializeCallId = 0; var runTestCallId = 1; var completeTestCallId = 2; +var evalCallbackCallId = 3; var frontendReopeningCount = 0; function reopenFrontend()