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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-runScript-async.html

Issue 2954093003: [DevTools] Migrate inspector-protocol/runtime tests to new harness (Closed)
Patch Set: fail: Created 3 years, 5 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 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/inspector-protocol-test.js"></script>
4 <script>
5
6 function test()
7 {
8 InspectorTest.runTestSuite([
9 function testRunAndCompileWithoutAgentEnable(next)
10 {
11 InspectorTest.sendCommandPromise("Runtime.compileScript", { expressi on: "", sourceURL: "", persistScript: true })
12 .then((result) => dumpResult(result))
13 .then(() => InspectorTest.sendCommandPromise("Runtime.runScript" , { scriptId: "1" }))
14 .then((result) => dumpResult(result))
15 .then(() => next());
16 },
17
18 function testSyntaxErrorInScript(next)
19 {
20 InspectorTest.sendCommandPromise("Runtime.enable", {})
21 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "\n }", sourceURL: "boo.js", persistScript: true }))
22 .then((result) => dumpResult(result))
23 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
24 .then(() => next());
25 },
26
27 function testSyntaxErrorInEvalInScript(next)
28 {
29 InspectorTest.sendCommandPromise("Runtime.enable", {})
30 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript : true }))
31 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId }))
32 .then((result) => dumpResult(result))
33 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
34 .then(() => next());
35 },
36
37 function testRunNotCompiledScript(next)
38 {
39 InspectorTest.sendCommandPromise("Runtime.enable", {})
40 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: "1" }))
41 .then((result) => dumpResult(result))
42 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
43 .then(() => next());
44 },
45
46 function testRunCompiledScriptAfterAgentWasReenabled(next)
47 {
48 var scriptId;
49 InspectorTest.sendCommandPromise("Runtime.enable", {})
50 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript : true }))
51 .then((result) => scriptId = result.result.scriptId)
52 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
53 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: scriptId }))
54 .then((result) => dumpResult(result))
55 .then(() => InspectorTest.sendCommandPromise("Runtime.enable", { }))
56 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: scriptId }))
57 .then((result) => dumpResult(result))
58 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
59 .then(() => next());
60 },
61
62 function testRunScriptWithPreview(next)
63 {
64 InspectorTest.sendCommandPromise("Runtime.enable", {})
65 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
66 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId, generatePreview: true }))
67 .then((result) => dumpResult(result))
68 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
69 .then(() => next());
70 },
71
72 function testRunScriptReturnByValue(next)
73 {
74 InspectorTest.sendCommandPromise("Runtime.enable", {})
75 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
76 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId, returnByValue: true }))
77 .then((result) => dumpResult(result))
78 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
79 .then(() => next());
80 },
81
82 function testAwaitNotPromise(next)
83 {
84 InspectorTest.sendCommandPromise("Runtime.enable", {})
85 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "({a:1})", sourceURL: "boo.js", persistScript: true }))
86 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId, awaitPromise: true }))
87 .then((result) => dumpResult(result))
88 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
89 .then(() => next());
90 },
91
92 function testAwaitResolvedPromise(next)
93 {
94 InspectorTest.sendCommandPromise("Runtime.enable", {})
95 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "Promise.resolve({a:1})", sourceURL: "boo.js", persistScript : true }))
96 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId, awaitPromise: true, returnByValue: t rue }))
97 .then((result) => dumpResult(result))
98 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
99 .then(() => next());
100 },
101
102 function testAwaitRejectedPromise(next)
103 {
104 InspectorTest.sendCommandPromise("Runtime.enable", {})
105 .then(() => InspectorTest.sendCommandPromise("Runtime.compileScr ipt", { expression: "Promise.reject({a:1})", sourceURL: "boo.js", persistScript: true }))
106 .then((result) => InspectorTest.sendCommandPromise("Runtime.runS cript", { scriptId: result.result.scriptId, awaitPromise: true, returnByValue: t rue }))
107 .then((result) => dumpResult(result))
108 .then(() => InspectorTest.sendCommandPromise("Runtime.disable", {}))
109 .then(() => next());
110 }
111 ]);
112
113 function dumpResult(result)
114 {
115 if (result.error) {
116 result.error.code = 0;
117 InspectorTest.logObject(result.error);
118 return;
119 }
120 result = result.result;
121 if (result.exceptionDetails) {
122 result.exceptionDetails.exceptionId = 0;
123 result.exceptionDetails.exception.objectId = 0;
124 }
125 if (result.exceptionDetails && result.exceptionDetails.scriptId)
126 result.exceptionDetails.scriptId = 0;
127 if (result.exceptionDetails && result.exceptionDetails.stackTrace) {
128 for (var frame of result.exceptionDetails.stackTrace.callFrames)
129 frame.scriptId = 0;
130 }
131 if (result.result && result.result.objectId)
132 result.result.objectId = "[ObjectId]";
133 InspectorTest.logObject(result);
134 }
135 }
136 </script>
137 </head>
138 <body onLoad="runTest();">
139 Tests that Runtime.compileScript and Runtime.runScript work with awaitPromise fl ag.
140 </body>
141 </html>
142
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698