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

Side by Side Diff: test/inspector/runtime/run-script-async.js

Issue 2379303002: Revert "[inspector] added inspector test runner [part 3-5]" (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 print("Tests that Runtime.compileScript and Runtime.runScript work with awaitPro mise flag.");
6
7 InspectorTest.runTestSuite([
8 function testRunAndCompileWithoutAgentEnable(next)
9 {
10 InspectorTest.sendCommandPromise("Runtime.compileScript", { expression: "", sourceURL: "", persistScript: true })
11 .then((result) => dumpResult(result))
12 .then(() => InspectorTest.sendCommandPromise("Runtime.runScript", { script Id: "1" }))
13 .then((result) => dumpResult(result))
14 .then(() => next());
15 },
16
17 function testSyntaxErrorInScript(next)
18 {
19 InspectorTest.sendCommandPromise("Runtime.enable", {})
20 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "\n }", sourceURL: "boo.js", persistScript: true }))
21 .then((result) => dumpResult(result))
22 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
23 .then(() => next());
24 },
25
26 function testSyntaxErrorInEvalInScript(next)
27 {
28 InspectorTest.sendCommandPromise("Runtime.enable", {})
29 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript: true }))
30 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId }))
31 .then((result) => dumpResult(result))
32 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
33 .then(() => next());
34 },
35
36 function testRunNotCompiledScript(next)
37 {
38 InspectorTest.sendCommandPromise("Runtime.enable", {})
39 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: "1" }))
40 .then((result) => dumpResult(result))
41 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
42 .then(() => next());
43 },
44
45 function testRunCompiledScriptAfterAgentWasReenabled(next)
46 {
47 var scriptId;
48 InspectorTest.sendCommandPromise("Runtime.enable", {})
49 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript: true }))
50 .then((result) => scriptId = result.result.scriptId)
51 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
52 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: scriptId }))
53 .then((result) => dumpResult(result))
54 .then(() => InspectorTest.sendCommandPromise("Runtime.enable", {}))
55 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: scriptId }))
56 .then((result) => dumpResult(result))
57 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
58 .then(() => next());
59 },
60
61 function testRunScriptWithPreview(next)
62 {
63 InspectorTest.sendCommandPromise("Runtime.enable", {})
64 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
65 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId, generatePreview: true }))
66 .then((result) => dumpResult(result))
67 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
68 .then(() => next());
69 },
70
71 function testRunScriptReturnByValue(next)
72 {
73 InspectorTest.sendCommandPromise("Runtime.enable", {})
74 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
75 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId, returnByValue: true }))
76 .then((result) => dumpResult(result))
77 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
78 .then(() => next());
79 },
80
81 function testAwaitNotPromise(next)
82 {
83 InspectorTest.sendCommandPromise("Runtime.enable", {})
84 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
85 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId, awaitPromise: true }))
86 .then((result) => dumpResult(result))
87 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
88 .then(() => next());
89 },
90
91 function testAwaitResolvedPromise(next)
92 {
93 InspectorTest.sendCommandPromise("Runtime.enable", {})
94 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "Promise.resolve({a:1})", sourceURL: "boo.js", persistScript: true }))
95 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId, awaitPromise: true, returnByValue: true }))
96 .then((result) => dumpResult(result))
97 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
98 .then(() => next());
99 },
100
101 function testAwaitRejectedPromise(next)
102 {
103 InspectorTest.sendCommandPromise("Runtime.enable", {})
104 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScript", { ex pression: "Promise.reject({a:1})", sourceURL: "boo.js", persistScript: true }))
105 .then((result) => InspectorTest.sendCommandPromise("Runtime.runScript", { scriptId: result.result.scriptId, awaitPromise: true, returnByValue: true }))
106 .then((result) => dumpResult(result))
107 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
108 .then(() => next());
109 }
110 ]);
111
112 function dumpResult(result)
113 {
114 if (result.error) {
115 result.error.code = 0;
116 InspectorTest.logObject(result.error);
117 return;
118 }
119 result = result.result;
120 if (result.exceptionDetails) {
121 result.exceptionDetails.exceptionId = 0;
122 result.exceptionDetails.exception.objectId = 0;
123 }
124 if (result.exceptionDetails && result.exceptionDetails.scriptId)
125 result.exceptionDetails.scriptId = 0;
126 if (result.exceptionDetails && result.exceptionDetails.stackTrace) {
127 for (var frame of result.exceptionDetails.stackTrace.callFrames)
128 frame.scriptId = 0;
129 }
130 if (result.result && result.result.objectId)
131 result.result.objectId = "[ObjectId]";
132 InspectorTest.logObject(result);
133 }
OLDNEW
« no previous file with comments | « test/inspector/runtime/property-on-console-proto-expected.txt ('k') | test/inspector/runtime/run-script-async-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698