Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
| index f0f43e8741bb2751b4797be2282183c70b6c7887..e58dab874c10c11dd0ed6d9a884eb9e17b59fd06 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js |
| @@ -74,7 +74,36 @@ InspectorTest.evaluateFunctionInOverlay = function(func, callback) |
| } |
| } |
| +InspectorTest.waitForOverlayRepaint = function(callback) |
| +{ |
| + InspectorTest.evaluateInPageAsync("requestAnimationFrame(%callback)", callback); |
|
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
|
| +} |
| + |
| + |
| var lastEvalId = 0; |
| +var asyncCallbacks = {}; |
| + |
| +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!
|
| +{ |
| + var id = ++lastEvalId; |
| + asyncCallbacks[id] = callback; |
| + var callbackString = `testRunner.evaluateInWebInspector.bind(testRunner, ${id}, "InspectorTest._evaluateInPageAsyncCompleted(${id})")`; |
| + var code = string.replace("%callback", callbackString); |
| + InspectorTest.evaluateInPage(code); |
| +}; |
| + |
| +InspectorTest._evaluateInPageAsyncCompleted = function(id) |
| +{ |
| + var callback = asyncCallbacks[id]; |
| + delete asyncCallbacks[id]; |
| + if (!callback) { |
| + InspectorTest.log("Error: no callback for async function"); |
| + InspectorTest.completeTest(); |
| + return; |
| + } |
| + callback(); |
| +} |
| + |
| var pendingEvalRequests = {}; |
| var lastPromiseEvalId = 0; |