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

Side by Side Diff: test/inspector/runtime/call-function-on-async.js

Issue 2499273003: [inspector] introduced Script::TYPE_INSPECTOR (Closed)
Patch Set: rebased Created 4 years, 1 month 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
« no previous file with comments | « test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 print("Tests that Runtime.callFunctionOn works with awaitPromise flag."); 5 print("Tests that Runtime.callFunctionOn works with awaitPromise flag.");
6 6
7 InspectorTest.runTestSuite([ 7 InspectorTest.runTestSuite([
8 function testArguments(next) 8 function testArguments(next)
9 { 9 {
10 callFunctionOn( 10 callFunctionOn(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 .then((result) => InspectorTest.logMessage(result)) 95 .then((result) => InspectorTest.logMessage(result))
96 .then(() => next()); 96 .then(() => next());
97 } 97 }
98 ]); 98 ]);
99 99
100 function callFunctionOn(objectExpression, functionDeclaration, argumentExpressio ns, returnByValue, generatePreview, awaitPromise) 100 function callFunctionOn(objectExpression, functionDeclaration, argumentExpressio ns, returnByValue, generatePreview, awaitPromise)
101 { 101 {
102 var objectId; 102 var objectId;
103 var callArguments = []; 103 var callArguments = [];
104 var promise = Protocol.Runtime.evaluate({ expression: objectExpression }) 104 var promise = Protocol.Runtime.evaluate({ expression: objectExpression })
105 .then((result) => objectId = result.result.result.objectId) 105 .then((result) => objectId = result.result.result.objectId);
106 for (let argumentExpression of argumentExpressions) { 106 for (let argumentExpression of argumentExpressions) {
107 promise = promise 107 promise = promise
108 .then(() => Protocol.Runtime.evaluate({ expression: argumentExpression })) 108 .then(() => Protocol.Runtime.evaluate({ expression: argumentExpression }))
109 .then((result) => addArgument(result.result.result)); 109 .then((result) => addArgument(result.result.result));
110 } 110 }
111 return promise.then(() => Protocol.Runtime.callFunctionOn({ objectId: objectId , functionDeclaration: functionDeclaration, arguments: callArguments, returnByVa lue: returnByValue, generatePreview: generatePreview, awaitPromise: awaitPromise })); 111 return promise.then(() => Protocol.Runtime.callFunctionOn({ objectId: objectId , functionDeclaration: functionDeclaration, arguments: callArguments, returnByVa lue: returnByValue, generatePreview: generatePreview, awaitPromise: awaitPromise }));
112 112
113 function addArgument(result) 113 function addArgument(result)
114 { 114 {
115 if (result.objectId) { 115 if (result.objectId) {
116 callArguments.push({ objectId: result.objectId }); 116 callArguments.push({ objectId: result.objectId });
117 } else if (result.value) { 117 } else if (result.value) {
118 callArguments.push({ value: result.value }) 118 callArguments.push({ value: result.value })
119 } else if (result.unserializableValue) { 119 } else if (result.unserializableValue) {
120 callArguments.push({ unserializableValue: result.unserializableValue }); 120 callArguments.push({ unserializableValue: result.unserializableValue });
121 } else if (result.type === "undefined") { 121 } else if (result.type === "undefined") {
122 callArguments.push({}); 122 callArguments.push({});
123 } else { 123 } else {
124 InspectorTest.log("Unexpected argument object:"); 124 InspectorTest.log("Unexpected argument object:");
125 InspectorTest.logMessage(result); 125 InspectorTest.logMessage(result);
126 InspectorTest.completeTest(); 126 InspectorTest.completeTest();
127 } 127 }
128 } 128 }
129 } 129 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698