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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html

Issue 2207973003: [DevTools] Removed InspectorTest.invokePageFunctionPromise from protocol tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html
index 964923de02c6eae259df4d16bad08e4410a096e3..fc3cbd3a0e8771ae6cde90272608ac6041daface 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html
@@ -358,61 +358,6 @@ InspectorTest.pageReloaded = function()
callback();
}
-var lastPromiseEvalId = 0;
-var pendingPromiseEvalRequests = {};
-
-/**
- * The given function should take two callback paraters before the arguments:
- * * resolve - called when successful (with optional result)
- * * reject - called when there was a failure (with optional error)
- */
-InspectorTest.invokePageFunctionPromise = function(functionName, parameters)
-{
- return new Promise(function(resolve, reject) {
- var id = ++lastPromiseEvalId;
- pendingPromiseEvalRequests[id] = { resolve: InspectorTest.safeWrap(resolve), reject: InspectorTest.safeWrap(reject) };
-
- var jsonParameters = [];
- for (var i = 0; i < parameters.length; ++i)
- jsonParameters.push(JSON.stringify(parameters[i]));
- var asyncEvalWrapper = function(callId, functionName, argumentsArray)
- {
- function evalCallbackResolve(result)
- {
- testRunner.evaluateInWebInspector(2, "InspectorTest.didInvokePageFunctionPromise(" + callId + ", " + JSON.stringify(result) + ", true);");
- }
-
- function evalCallbackReject(result)
- {
- testRunner.evaluateInWebInspector(2, "InspectorTest.didInvokePageFunctionPromise(" + callId + ", " + JSON.stringify(result) + ", false);");
- }
-
- var args = [evalCallbackResolve, evalCallbackReject].concat(argumentsArray.map(JSON.stringify));
- var functionCall = functionName + ".call(null, " + args.join(", ") + ")";
- try {
- eval(functionCall);
- } catch(e) {
- InspectorTest.log("Error: " + e);
- evalCallbackReject(e);
- }
- }
- var pageRequest = "(" + asyncEvalWrapper.toString() + ")(" + id + ", unescape('" + escape(functionName) + "'), [" + jsonParameters.join(", ") + "])";
- InspectorTest.evaluateInPage(pageRequest);
- });
-}
-
-InspectorTest.didInvokePageFunctionPromise = function(callId, value, didResolve)
-{
- var callbacks = pendingPromiseEvalRequests[callId];
- if (!callbacks) {
- InspectorTest.log("Missing callback for async eval " + callId + ", perhaps callback invoked twice?");
- return;
- }
- var callback = didResolve ? callbacks.resolve : callbacks.reject;
- delete pendingPromiseEvalRequests[callId];
- callback(value);
-}
-
window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest), false);
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-pause.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698