| Index: LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js
|
| diff --git a/LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js b/LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js
|
| index 24d460e403ba003799ffa6782f1daccedf98c31b..9dc31f6321ef75076e9dd371400719266197e658 100644
|
| --- a/LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js
|
| +++ b/LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js
|
| @@ -51,6 +51,21 @@ InspectorTest.sendCommand = function(method, params, handler)
|
| return this._requestId;
|
| }
|
|
|
| +InspectorTest.sendCommandOrDie = function(command, properties, callback)
|
| +{
|
| + InspectorTest.sendCommand(command, properties || {}, commandCallback);
|
| + function commandCallback(msg)
|
| + {
|
| + if (msg.error) {
|
| + InspectorTest.log("ERROR: " + msg.error.message);
|
| + InspectorTest.completeTest();
|
| + return;
|
| + }
|
| + if (callback)
|
| + callback(msg.result);
|
| + }
|
| +}
|
| +
|
| /**
|
| * @param {function(object)=} callback
|
| */
|
| @@ -231,6 +246,46 @@ InspectorTest.importScript = function(scriptName)
|
| window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName);
|
| }
|
|
|
| +InspectorTest.requestMainFrameId = function(callback)
|
| +{
|
| + InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled);
|
| +
|
| + function pageEnabled()
|
| + {
|
| + InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeLoaded);
|
| + }
|
| +
|
| + function resourceTreeLoaded(payload)
|
| + {
|
| + callback(payload.frameTree.frame.id);
|
| + }
|
| +};
|
| +
|
| +InspectorTest.requestDocumentNodeId = function(callback)
|
| +{
|
| + InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument);
|
| +
|
| + function onGotDocument(result)
|
| + {
|
| + callback(result.root.nodeId);
|
| + }
|
| +};
|
| +
|
| +InspectorTest.requestNodeId = function(selector, callback)
|
| +{
|
| + InspectorTest.requestDocumentNodeId(onGotDocumentNodeId);
|
| +
|
| + function onGotDocumentNodeId(documentNodeId)
|
| + {
|
| + InspectorTest.sendCommandOrDie("DOM.querySelector", { "nodeId": documentNodeId , "selector": selector }, onGotNode);
|
| + }
|
| +
|
| + function onGotNode(result)
|
| + {
|
| + callback(result.nodeId);
|
| + }
|
| +};
|
| +
|
| };
|
|
|
| var outputElement;
|
|
|