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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js

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-compileScript.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js
new file mode 100644
index 0000000000000000000000000000000000000000..7bfc5ca861f6cf5f8e4d3635ebbc0c3fbe4e9d15
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-compileScript.js
@@ -0,0 +1,40 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank(``);
+
+ await dp.Debugger.enable();
+ dp.Debugger.onScriptParsed(messageObject => {
+ if (!messageObject.params.url)
+ return;
+ testRunner.log('Debugger.scriptParsed: ' + messageObject.params.url);
+ });
+
+ dp.Runtime.enable();
+ var message = await dp.Runtime.onceExecutionContextCreated();
+ var executionContextId = message.params.context.id;
+ await testCompileScript('\n (', false, 'foo1.js');
+ await testCompileScript('239', true, 'foo2.js');
+ await testCompileScript('239', false, 'foo3.js');
+ await testCompileScript('testfunction f()\n{\n return 0;\n}\n', false, 'foo4.js');
+ testRunner.completeTest();
+
+ async function testCompileScript(expression, persistScript, sourceURL) {
+ testRunner.log('Compiling script: ' + sourceURL);
+ testRunner.log(' persist: ' + persistScript);
+ var messageObject = await dp.Runtime.compileScript({
+ expression: expression,
+ sourceURL: sourceURL,
+ persistScript: persistScript,
+ executionContextId: executionContextId
+ });
+ var result = messageObject.result;
+ if (result.exceptionDetails) {
+ result.exceptionDetails.exceptionId = 0;
+ result.exceptionDetails.exception.objectId = 0;
+ result.exceptionDetails.scriptId = 0;
+ }
+ if (result.scriptId)
+ result.scriptId = 0;
+ testRunner.logObject(result, 'compilation result: ');
+ testRunner.log('-----');
+ }
+})

Powered by Google App Engine
This is Rietveld 408576698