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

Unified Diff: LayoutTests/http/tests/inspector-protocol/inspector-protocol-test.js

Issue 177963004: DevTools: Split creating inspector stylesheet and adding a new rule into stylesheet in protocol. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698