Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |