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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js

Issue 2182373002: DevTools: fix inspector/elements/css-rule-hover-highlights-selectors.html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lastEvalId Created 4 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
OLDNEW
1 if (window.GCController) 1 if (window.GCController)
2 GCController.collectAll(); 2 GCController.collectAll();
3 var initialize_InspectorTest = function() { 3 var initialize_InspectorTest = function() {
4 4
5 var results = []; 5 var results = [];
6 6
7 function consoleOutputHook(messageType) 7 function consoleOutputHook(messageType)
8 { 8 {
9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1)); 9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1));
10 } 10 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 var expression = "testRunner.evaluateInWebInspectorOverlay(\"(\" + " + func + " + \")()\")"; 67 var expression = "testRunner.evaluateInWebInspectorOverlay(\"(\" + " + func + " + \")()\")";
68 var mainContext = InspectorTest.runtimeModel.executionContexts()[0]; 68 var mainContext = InspectorTest.runtimeModel.executionContexts()[0];
69 mainContext.evaluate(expression, "", false, false, true, false, false, wrapC allback); 69 mainContext.evaluate(expression, "", false, false, true, false, false, wrapC allback);
70 70
71 function wrapCallback(val, err, result) 71 function wrapCallback(val, err, result)
72 { 72 {
73 callback(result.value) 73 callback(result.value)
74 } 74 }
75 } 75 }
76 76
77 InspectorTest.waitForOverlayRepaint = function(callback)
78 {
79 InspectorTest.evaluateInPageAsync("requestAnimationFrame(%callback)", callba ck);
caseq 2016/07/27 00:48:25 Rather than using rAF, you probably want testRunne
lushnikov 2016/07/27 03:14:46 I'm not sure if the layoutAndPaintAsyncThen will f
80 }
81
82
77 var lastEvalId = 0; 83 var lastEvalId = 0;
84 var asyncCallbacks = {};
85
86 InspectorTest.evaluateInPageAsync = function(string, callback)
caseq 2016/07/27 00:48:25 Please don't. See invokeInPageAsync: https://cs.ch
lushnikov 2016/07/27 03:14:46 Beautiful. Thank you!
87 {
88 var id = ++lastEvalId;
89 asyncCallbacks[id] = callback;
90 var callbackString = `testRunner.evaluateInWebInspector.bind(testRunner, ${i d}, "InspectorTest._evaluateInPageAsyncCompleted(${id})")`;
91 var code = string.replace("%callback", callbackString);
92 InspectorTest.evaluateInPage(code);
93 };
94
95 InspectorTest._evaluateInPageAsyncCompleted = function(id)
96 {
97 var callback = asyncCallbacks[id];
98 delete asyncCallbacks[id];
99 if (!callback) {
100 InspectorTest.log("Error: no callback for async function");
101 InspectorTest.completeTest();
102 return;
103 }
104 callback();
105 }
106
78 var pendingEvalRequests = {}; 107 var pendingEvalRequests = {};
79 108
80 var lastPromiseEvalId = 0; 109 var lastPromiseEvalId = 0;
81 var pendingPromiseEvalRequests = {}; 110 var pendingPromiseEvalRequests = {};
82 111
83 /** 112 /**
84 * The given function should take two callback paraters before the arguments: 113 * The given function should take two callback paraters before the arguments:
85 * * resolve - called when successful (with optional result) 114 * * resolve - called when successful (with optional result)
86 * * reject - called when there was a failure (with optional error) 115 * * reject - called when there was a failure (with optional error)
87 */ 116 */
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 _output("[page] " + text); 1242 _output("[page] " + text);
1214 } 1243 }
1215 1244
1216 function _output(result) 1245 function _output(result)
1217 { 1246 {
1218 if (!outputElement) 1247 if (!outputElement)
1219 createOutputElement(); 1248 createOutputElement();
1220 outputElement.appendChild(document.createTextNode(result)); 1249 outputElement.appendChild(document.createTextNode(result));
1221 outputElement.appendChild(document.createElement("br")); 1250 outputElement.appendChild(document.createElement("br"));
1222 } 1251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698