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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-callFunctionOn-async.html

Issue 2954093003: [DevTools] Migrate inspector-protocol/runtime tests to new harness (Closed)
Patch Set: fail: Created 3 years, 6 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: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-callFunctionOn-async.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-callFunctionOn-async.html b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-callFunctionOn-async.html
deleted file mode 100644
index a52e39926cecbffe456deed37a2af2c27025941b..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-callFunctionOn-async.html
+++ /dev/null
@@ -1,152 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-
-testRunner.setDumpConsoleMessages(false);
-function test()
-{
- InspectorTest.runTestSuite([
- function testArguments(next)
- {
- callFunctionOn(
- "({a : 1})",
- "function(arg1, arg2, arg3, arg4) { return \"\" + arg1 + \"|\" + arg2 + \"|\" + arg3 + \"|\" + arg4; }",
- [ "undefined", "NaN", "({a:2})", "window"],
- /* returnByValue */ true,
- /* generatePreview */ false,
- /* awaitPromise */ false)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- },
-
- function testSyntaxErrorInFunction(next)
- {
- callFunctionOn(
- "({a : 1})",
- "\n }",
- [],
- /* returnByValue */ false,
- /* generatePreview */ false,
- /* awaitPromise */ true)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- },
-
- function testExceptionInFunctionExpression(next)
- {
- callFunctionOn(
- "({a : 1})",
- "(function() { throw new Error() })()",
- [],
- /* returnByValue */ false,
- /* generatePreview */ false,
- /* awaitPromise */ true)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- },
-
- function testFunctionReturnNotPromise(next)
- {
- callFunctionOn(
- "({a : 1})",
- "(function() { return 239; })",
- [],
- /* returnByValue */ false,
- /* generatePreview */ false,
- /* awaitPromise */ true)
- .then((result) => InspectorTest.logObject(result.error))
- .then(() => next());
- },
-
- function testFunctionReturnResolvedPromiseReturnByValue(next)
- {
- callFunctionOn(
- "({a : 1})",
- "(function(arg) { return Promise.resolve({a : this.a + arg.a}); })",
- [ "({a:2})" ],
- /* returnByValue */ true,
- /* generatePreview */ false,
- /* awaitPromise */ true)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- },
-
- function testFunctionReturnResolvedPromiseWithPreview(next)
- {
- callFunctionOn(
- "({a : 1})",
- "(function(arg) { return Promise.resolve({a : this.a + arg.a}); })",
- [ "({a:2})" ],
- /* returnByValue */ false,
- /* generatePreview */ true,
- /* awaitPromise */ true)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- },
-
- function testFunctionReturnRejectedPromise(next)
- {
- callFunctionOn(
- "({a : 1})",
- "(function(arg) { return Promise.reject({a : this.a + arg.a}); })",
- [ "({a:2})" ],
- /* returnByValue */ true,
- /* generatePreview */ false,
- /* awaitPromise */ true)
- .then((result) => dumpResult(result.result))
- .then(() => next());
- }
- ]);
-
- function callFunctionOn(objectExpression, functionDeclaration, argumentExpressions, returnByValue, generatePreview, awaitPromise)
- {
- var objectId;
- var callArguments = [];
- var promise = InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: objectExpression })
- .then((result) => objectId = result.result.result.objectId)
- for (let argumentExpression of argumentExpressions) {
- promise = promise
- .then(() => InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: argumentExpression }))
- .then((result) => addArgument(result.result.result));
- }
- return promise.then(() => InspectorTest.sendCommandPromise("Runtime.callFunctionOn", { objectId: objectId, functionDeclaration: functionDeclaration, arguments: callArguments, returnByValue: returnByValue, generatePreview: generatePreview, awaitPromise: awaitPromise }));
-
- function addArgument(result)
- {
- if (result.objectId) {
- callArguments.push({ objectId: result.objectId });
- } else if (result.value) {
- callArguments.push({ value: result.value })
- } else if (result.unserializableValue) {
- callArguments.push({ unserializableValue: result.unserializableValue });
- } else if (result.type === "undefined") {
- callArguments.push({});
- } else {
- InspectorTest.log("Unexpected argument object:");
- InspectorTest.logObject(result);
- InspectorTest.completeTest();
- }
- }
- }
-
- function dumpResult(result)
- {
- if (result.exceptionDetails && result.exceptionDetails.scriptId)
- result.exceptionDetails.scriptId = 0;
- if (result.result && result.result.objectId)
- result.result.objectId = "[ObjectId]";
- if (result.exceptionDetails) {
- result.exceptionDetails.exceptionId = 0;
- result.exceptionDetails.exception.objectId = 0;
- }
- InspectorTest.logObject(result);
- }
-}
-</script>
-</head>
-<body onLoad="runTest();">
-Tests that Runtime.callFunctionOn works with awaitPromise flag.
-</body>
-</html>
-

Powered by Google App Engine
This is Rietveld 408576698