Commit 9a3b9b7b authored by Will Chen's avatar Will Chen Committed by Commit Bot

DevTools: improve TestRunner.evaluateInPage* API

Most of the call sites simply unwrap the value from the SDK.RemoteObject
returned from evaluateInPage*, this updates the API so it returns the plain
value and adds additional methods evaluateInPageRemoteObject{|Promise} for
the handful of callsites that need a RemoteObject.

Bug: 667560
Change-Id: I067b338056089f8263b0972f6630aa1e821eb846
Reviewed-on: https://chromium-review.googlesource.com/792010
Commit-Queue: Will Chen <chenwilliam@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519914}
parent 81d9e65f
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
TestRunner.addResult('Expected score must be equal to the actual score'); TestRunner.addResult('Expected score must be equal to the actual score');
function step1(filePaths) { function step1(filePaths) {
var files = filePaths.value.split(':'); var files = filePaths.split(':');
TestRunner.addResult('Test set size: ' + files.length); TestRunner.addResult('Test set size: ' + files.length);
for (var i = 0; i < TestQueries.length; ++i) { for (var i = 0; i < TestQueries.length; ++i) {
runQuery(files, TestQueries[i][0], TestQueries[i][1]); runQuery(files, TestQueries[i][0], TestQueries[i][1]);
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
} }
function dumpCounter(result) { function dumpCounter(result) {
TestRunner.addResult('window.counter = ' + result.value); TestRunner.addResult('window.counter = ' + result);
requestMyClassWithMixinCompletions(); requestMyClassWithMixinCompletions();
} }
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
ConsoleTestRunner.evaluateInConsole('runTestsInPage(getEventListeners)', async function() { ConsoleTestRunner.evaluateInConsole('runTestsInPage(getEventListeners)', async function() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
}); });
})(); })();
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
} }
function step5(result) { function step5(result) {
var text = result.description; var text = result;
TestRunner.assertEquals(15, text.length, 'text length'); TestRunner.assertEquals(15, text.length, 'text length');
TestRunner.assertEquals(8, countTextNodes(text), 'nodes count'); TestRunner.assertEquals(8, countTextNodes(text), 'nodes count');
TestRunner.assertEquals(1, countTextNodes('"' + text + '"'), 'nodes with quoted text count'); TestRunner.assertEquals(1, countTextNodes('"' + text + '"'), 'nodes with quoted text count');
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
function advance() { function advance() {
var next = current + 1; var next = current + 1;
if (next == total.description) if (next == total)
finish(); finish();
else else
loopOverGlobals(next, total); loopOverGlobals(next, total);
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
function loopOverGlobals(current, total) { function loopOverGlobals(current, total) {
function advance() { function advance() {
var next = current + 1; var next = current + 1;
if (next == total.description) if (next == total)
ConsoleTestRunner.waitForRemoteObjectsConsoleMessages(onRemoteObjectsLoaded); ConsoleTestRunner.waitForRemoteObjectsConsoleMessages(onRemoteObjectsLoaded);
else else
loopOverGlobals(next, total); loopOverGlobals(next, total);
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
} }
function dumpAccessedGetAndExpand(result) { function dumpAccessedGetAndExpand(result) {
TestRunner.addResult('window.accessedGet = ' + result.value); TestRunner.addResult('window.accessedGet = ' + result);
ConsoleTestRunner.expandConsoleMessages(dumpExpandedConsoleMessages); ConsoleTestRunner.expandConsoleMessages(dumpExpandedConsoleMessages);
} }
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
} }
function dumpAccessedGetAndCompleteTest(result) { function dumpAccessedGetAndCompleteTest(result) {
TestRunner.addResult('window.accessedGet = ' + result.value); TestRunner.addResult('window.accessedGet = ' + result);
TestRunner.completeTest(); TestRunner.completeTest();
} }
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
TestRunner.evaluateInPage('runNextPromiseTest()', callback); TestRunner.evaluateInPage('runNextPromiseTest()', callback);
function callback(result) { function callback(result) {
if (!result.value) if (!result)
ConsoleTestRunner.expandConsoleMessages(dump); ConsoleTestRunner.expandConsoleMessages(dump);
} }
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
var codeSnippetText; var codeSnippetText;
function onCodeSnippet(result) { function onCodeSnippet(result) {
codeSnippetText = result.value; codeSnippetText = result;
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
var codeSnippetText; var codeSnippetText;
function onCodeSnippet(result) { function onCodeSnippet(result) {
codeSnippetText = result.value; codeSnippetText = result;
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
} }
......
...@@ -48,7 +48,7 @@ function submitWord(url) { ...@@ -48,7 +48,7 @@ function submitWord(url) {
TestRunner.evaluateInPage('codeSnippet();', onCodeSnippet); TestRunner.evaluateInPage('codeSnippet();', onCodeSnippet);
function onCodeSnippet(result) { function onCodeSnippet(result) {
var codeLines = result.value; var codeLines = result;
textEditor.setText(codeLines); textEditor.setText(codeLines);
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
} }
......
...@@ -48,7 +48,7 @@ function submitWord(url) { ...@@ -48,7 +48,7 @@ function submitWord(url) {
TestRunner.evaluateInPage('codeSnippet();', onCodeSnippet); TestRunner.evaluateInPage('codeSnippet();', onCodeSnippet);
function onCodeSnippet(result) { function onCodeSnippet(result) {
var codeLines = result.value; var codeLines = result;
textEditor.setText(codeLines); textEditor.setText(codeLines);
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
} }
......
...@@ -40,7 +40,7 @@ while (sum &gt; 0) { ...@@ -40,7 +40,7 @@ while (sum &gt; 0) {
textEditor.element.focus(); textEditor.element.focus();
function step2(result) { function step2(result) {
var codeLines = result.value; var codeLines = result;
SourcesTestRunner.typeIn(textEditor, codeLines, step3); SourcesTestRunner.typeIn(textEditor, codeLines, step3);
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
var codeSnippetText; var codeSnippetText;
function onCodeSnippet(result) { function onCodeSnippet(result) {
codeSnippetText = result.value; codeSnippetText = result;
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
} }
......
...@@ -127,7 +127,7 @@ c ...@@ -127,7 +127,7 @@ c
var command = 'codeSnippet(\'' + snippetName + '\');'; var command = 'codeSnippet(\'' + snippetName + '\');';
TestRunner.evaluateInPage(command, step2); TestRunner.evaluateInPage(command, step2);
function step2(result) { function step2(result) {
textEditor.setText(result.value); textEditor.setText(result);
var indent = textEditor.indent(); var indent = textEditor.indent();
var description = indent === TextUtils.TextUtils.Indent.TabCharacter ? 'Tab' : indent.length + ' spaces'; var description = indent === TextUtils.TextUtils.Indent.TabCharacter ? 'Tab' : indent.length + ' spaces';
TestRunner.addResult('Autodetected indentation for ' + snippetName + ': ' + description); TestRunner.addResult('Autodetected indentation for ' + snippetName + ': ' + description);
...@@ -137,8 +137,8 @@ c ...@@ -137,8 +137,8 @@ c
function onTestNumberReceived(result) { function onTestNumberReceived(result) {
var testSuite = []; var testSuite = [];
TestRunner.addResult('Tests number: ' + result.value); TestRunner.addResult('Tests number: ' + result);
for (var i = 1; i <= result.value; ++i) for (var i = 1; i <= result; ++i)
testSuite.push(genericTest.bind(this, 'test' + i)); testSuite.push(genericTest.bind(this, 'test' + i));
TestRunner.runTestSuite(testSuite); TestRunner.runTestSuite(testSuite);
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
TestRunner.evaluateInPage('matchingElements(\'' + escapedPath + '\')', callback); TestRunner.evaluateInPage('matchingElements(\'' + escapedPath + '\')', callback);
function callback(result) { function callback(result) {
TestRunner.assertEquals(1, result.value); TestRunner.assertEquals(1, result);
dumpNodeData(); dumpNodeData();
} }
} }
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
TestRunner.evaluateInPagePromise('pseudoIframeVisibility()').then(function(result) { TestRunner.evaluateInPagePromise('pseudoIframeVisibility()').then(function(result) {
TestRunner.addResult('=== Added hide shortcut in frame ==='); TestRunner.addResult('=== Added hide shortcut in frame ===');
TestRunner.addResult('=== Frame node is hidden ==='); TestRunner.addResult('=== Frame node is hidden ===');
TestRunner.addResult('visibility: ' + result.value + ';'); TestRunner.addResult('visibility: ' + result + ';');
next(); next();
}); });
} }
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
function callback() { function callback() {
var pseudoNodeTypeArg = pseudoNode.pseudoType() ? ('"' + pseudoNode.pseudoType() + '"') : 'undefined'; var pseudoNodeTypeArg = pseudoNode.pseudoType() ? ('"' + pseudoNode.pseudoType() + '"') : 'undefined';
TestRunner.evaluateInPagePromise('pseudoVisibility(' + pseudoNodeTypeArg + ')').then(function(result) { TestRunner.evaluateInPagePromise('pseudoVisibility(' + pseudoNodeTypeArg + ')').then(function(result) {
TestRunner.addResult('::' + pseudoNode.pseudoType() + ' node visibility: \'' + result.value + '\''); TestRunner.addResult('::' + pseudoNode.pseudoType() + ' node visibility: \'' + result + '\'');
next(); next();
}); });
} }
......
...@@ -15,11 +15,9 @@ ...@@ -15,11 +15,9 @@
</p> </p>
`); `);
TestRunner.evaluateInPage('document', didReceiveDocumentObject); var remoteObject = await TestRunner.evaluateInPageRemoteObject('document');
async function didReceiveDocumentObject(remoteObject) { TestRunner.addResult('didReceiveDocumentObject');
TestRunner.addResult('didReceiveDocumentObject'); var nodeId = await TestRunner.DOMAgent.requestNode(remoteObject.objectId);
var nodeId = await TestRunner.DOMAgent.requestNode(remoteObject.objectId); TestRunner.addResult('didRequestNode error = ' + (nodeId ? 'null' : 'error'));
TestRunner.addResult('didRequestNode error = ' + (nodeId ? 'null' : 'error')); TestRunner.completeTest();
TestRunner.completeTest();
}
})(); })();
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
} }
`); `);
TestRunner.evaluateInPage('whitespaceChild()', childCallback); var childObject = await TestRunner.evaluateInPageRemoteObject('whitespaceChild()');
function childCallback(childObject) { ElementsTestRunner.firstElementsTreeOutline().addEventListener(
ElementsTestRunner.firstElementsTreeOutline().addEventListener( Elements.ElementsTreeOutline.Events.SelectedNodeChanged, selectedNodeChanged);
Elements.ElementsTreeOutline.Events.SelectedNodeChanged, selectedNodeChanged); Common.Revealer.reveal(childObject);
Common.Revealer.reveal(childObject);
}
function selectedNodeChanged(event) { function selectedNodeChanged(event) {
var node = event.data.node; var node = event.data.node;
......
...@@ -71,7 +71,7 @@ function test() { ...@@ -71,7 +71,7 @@ function test() {
} }
function onStyleFetched(result) { function onStyleFetched(result) {
Formatter.formatterWorkerPool().parseCSS(result.value, onRulesParsed); Formatter.formatterWorkerPool().parseCSS(result, onRulesParsed);
} }
TestRunner.evaluateInPage('getCSS()', onStyleFetched); TestRunner.evaluateInPage('getCSS()', onStyleFetched);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
`); `);
function callback(result) { function callback(result) {
TestRunner.addResult('2 + 2 = ' + result.description); TestRunner.addResult('2 + 2 = ' + result);
TestRunner.completeTest(); TestRunner.completeTest();
} }
TestRunner.evaluateInPage('sum(2, 2)', callback); TestRunner.evaluateInPage('sum(2, 2)', callback);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
function checkGreetingSet(next) { function checkGreetingSet(next) {
TestRunner.evaluateInPage('getGreeting()', callback); TestRunner.evaluateInPage('getGreeting()', callback);
function callback(result) { function callback(result) {
TestRunner.addResult('Received: ' + result.value); TestRunner.addResult('Received: ' + result);
next(); next();
} }
}, },
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
async function callback() { async function callback() {
const output = await TestRunner.evaluateInPageAsync('originalJSONStringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('originalJSONStringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
async function step2() { async function step2() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
var request1 = NetworkTestRunner.networkRequests().pop(); var request1 = NetworkTestRunner.networkRequests().pop();
TestRunner.addResult(request1.url()); TestRunner.addResult(request1.url());
TestRunner.addResult('resource.type: ' + request1.resourceType()); TestRunner.addResult('resource.type: ' + request1.resourceType());
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
NetworkTestRunner.makeFetchInWorker('resource.php', {}, fetchCallback); NetworkTestRunner.makeFetchInWorker('resource.php', {}, fetchCallback);
function fetchCallback(result) { function fetchCallback(result) {
TestRunner.addResult('Fetch in worker result: ' + result.value); TestRunner.addResult('Fetch in worker result: ' + result);
var requests = NetworkTestRunner.networkRequests(); var requests = NetworkTestRunner.networkRequests();
requests.forEach((request) => { requests.forEach((request) => {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
TestRunner.callFunctionInPageAsync('makeFetchesInWorker', [['./resource.php?1', './resource.php?2']]) TestRunner.callFunctionInPageAsync('makeFetchesInWorker', [['./resource.php?1', './resource.php?2']])
.then((result) => { .then((result) => {
TestRunner.addResult('Parallel fetch in worker result: ' + result.value); TestRunner.addResult('Parallel fetch in worker result: ' + result);
var requests = NetworkTestRunner.networkRequests(); var requests = NetworkTestRunner.networkRequests();
requests.forEach((request) => { requests.forEach((request) => {
TestRunner.addResult(request.url()); TestRunner.addResult(request.url());
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
NetworkTestRunner.makeFetchInWorker('resource.php', {}, fetchCallback); NetworkTestRunner.makeFetchInWorker('resource.php', {}, fetchCallback);
function fetchCallback(result) { function fetchCallback(result) {
TestRunner.addResult('Fetch in worker result: ' + result.value); TestRunner.addResult('Fetch in worker result: ' + result);
var requests = NetworkTestRunner.networkRequests(); var requests = NetworkTestRunner.networkRequests();
requests.forEach((request) => { requests.forEach((request) => {
......
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
(async function() { (async function() {
TestRunner.addResult(`Tests formatting of different types of remote objects.\n`); TestRunner.addResult(`Tests formatting of different types of remote objects.\n`);
var result = await TestRunner.evaluateInPageRemoteObject('new Date(2011, 11, 7, 12, 01)');
function callback(result) { TestRunner.addResult('date = ' + result.description.substring(0, 25));
TestRunner.addResult('date = ' + result.description.substring(0, 25)); TestRunner.completeTest();
TestRunner.completeTest();
}
TestRunner.evaluateInPage('new Date(2011, 11, 7, 12, 01)', callback);
})(); })();
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
} }
var result = await TestRunner.RuntimeAgent.callFunctionOn(sum.toString(), obj1.objectId); var result = await TestRunner.RuntimeAgent.callFunctionOn(sum.toString(), obj1.objectId);
TestRunner.addResult(result.value); TestRunner.addResult(result);
next(); next();
}, },
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
var result = var result =
await TestRunner.RuntimeAgent.callFunctionOn(format.toString(), obj1.objectId, [obj1, obj2, {value: 4}, {}]); await TestRunner.RuntimeAgent.callFunctionOn(format.toString(), obj1.objectId, [obj1, obj2, {value: 4}, {}]);
TestRunner.addResult(result.value); TestRunner.addResult(result);
next(); next();
} }
]); ]);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
TestRunner.evaluateInPage('dump()', dumpCallback); TestRunner.evaluateInPage('dump()', dumpCallback);
function dumpCallback(result) { function dumpCallback(result) {
TestRunner.addResult(result.value); TestRunner.addResult(result);
next(); next();
} }
} }
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
TestRunner.evaluateInPage('dump()', dumpCallback); TestRunner.evaluateInPage('dump()', dumpCallback);
function dumpCallback(result) { function dumpCallback(result) {
original = result.value; original = result;
next(); next();
} }
}, },
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
} }
function dumpCallback(result) { function dumpCallback(result) {
TestRunner.addResult('Equals to initial: ' + (original === result.value ? 'true' : 'false')); TestRunner.addResult('Equals to initial: ' + (original === result ? 'true' : 'false'));
next(); next();
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
ApplicationTestRunner.makeFetchInServiceWorker(scope, '../../network/resources/resource.php', {}, fetchCallback); ApplicationTestRunner.makeFetchInServiceWorker(scope, '../../network/resources/resource.php', {}, fetchCallback);
function fetchCallback(result) { function fetchCallback(result) {
TestRunner.addResult('Fetch in worker result: ' + result.value); TestRunner.addResult('Fetch in worker result: ' + result);
var requests = NetworkTestRunner.networkRequests(); var requests = NetworkTestRunner.networkRequests();
requests.forEach((request) => { requests.forEach((request) => {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
ApplicationTestRunner.makeFetchInServiceWorker(scope, '../../network/resources/resource.php', {}, fetchCallback); ApplicationTestRunner.makeFetchInServiceWorker(scope, '../../network/resources/resource.php', {}, fetchCallback);
function fetchCallback(result) { function fetchCallback(result) {
TestRunner.addResult('Fetch in worker result: ' + result.value); TestRunner.addResult('Fetch in worker result: ' + result);
var requests = NetworkTestRunner.networkRequests(); var requests = NetworkTestRunner.networkRequests();
requests.forEach((request) => { requests.forEach((request) => {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
function dumpInterceptedRequests() { function dumpInterceptedRequests() {
return TestRunner.callFunctionInPageAsync('takeInterceptedRequests', [scope]).then((data) => { return TestRunner.callFunctionInPageAsync('takeInterceptedRequests', [scope]).then((data) => {
TestRunner.addResult('Intercepted requests:'); TestRunner.addResult('Intercepted requests:');
JSON.parse(data.value).forEach((request) => { JSON.parse(data).forEach((request) => {
TestRunner.addResult(' url: ' + request.url); TestRunner.addResult(' url: ' + request.url);
TestRunner.addResult(' mode: ' + request.mode); TestRunner.addResult(' mode: ' + request.mode);
}); });
...@@ -52,15 +52,15 @@ ...@@ -52,15 +52,15 @@
TestRunner.addResult('CORS fetch(): ' + index); TestRunner.addResult('CORS fetch(): ' + index);
return TestRunner.callFunctionInPageAsync('fetchInIframe', [target + '?type=txt&fetch' + index, frameId]) return TestRunner.callFunctionInPageAsync('fetchInIframe', [target + '?type=txt&fetch' + index, frameId])
.then((data) => { .then((data) => {
if (data.value !== 'hello') { if (data !== 'hello') {
TestRunner.addResult('fetch response miss match: ' + data.value); TestRunner.addResult('fetch response miss match: ' + data);
} }
TestRunner.addResult('CORS XHR: ' + index); TestRunner.addResult('CORS XHR: ' + index);
return TestRunner.callFunctionInPageAsync('xhrInIframe', [target + '?type=txt&xhr' + index, frameId]); return TestRunner.callFunctionInPageAsync('xhrInIframe', [target + '?type=txt&xhr' + index, frameId]);
}) })
.then((data) => { .then((data) => {
if (data.value !== 'hello') { if (data !== 'hello') {
TestRunner.addResult('XHR response miss match: ' + data.value); TestRunner.addResult('XHR response miss match: ' + data);
} }
TestRunner.addResult('CORS image: ' + index); TestRunner.addResult('CORS image: ' + index);
return TestRunner.callFunctionInPageAsync('corsImageInIframe', [target + '?type=img&img' + index, frameId]); return TestRunner.callFunctionInPageAsync('corsImageInIframe', [target + '?type=img&img' + index, frameId]);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
return TestRunner.callFunctionInPageAsync('getIframeBodyText', [frame_id]); return TestRunner.callFunctionInPageAsync('getIframeBodyText', [frame_id]);
}) })
.then((data) => { .then((data) => {
TestRunner.addResult(' body: ' + data.value); TestRunner.addResult(' body: ' + data);
}); });
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script src="../../inspector/console-test.js"></script> <script src="../../inspector/console-test.js"></script>
<script> <script>
function test() { async function test() {
const scriptURL = 'http://127.0.0.1:8000/devtools/service-workers/resources/changing-worker.php'; const scriptURL = 'http://127.0.0.1:8000/devtools/service-workers/resources/changing-worker.php';
const scope = 'http://127.0.0.1:8000/devtools/service-workers/resources/service-worker-redundant-scope/'; const scope = 'http://127.0.0.1:8000/devtools/service-workers/resources/service-worker-redundant-scope/';
const frameId = 'frame_id'; const frameId = 'frame_id';
...@@ -15,58 +15,57 @@ function test() { ...@@ -15,58 +15,57 @@ function test() {
let secondVersionId = -1; let secondVersionId = -1;
Resources.ServiceWorkersView._noThrottle = true; Resources.ServiceWorkersView._noThrottle = true;
TestRunner.evaluateInPage('frontendReopeningCount', function(result) { var result = await TestRunner.evaluateInPageRemoteObject('frontendReopeningCount');
if (result._description == '0') { if (result._description == '0') {
TestRunner.addSniffer(Resources.ServiceWorkersView.prototype, '_updateRegistration', updateRegistration, true); TestRunner.addSniffer(Resources.ServiceWorkersView.prototype, '_updateRegistration', updateRegistration, true);
function updateRegistration(registration) { function updateRegistration(registration) {
if (registration.scopeURL != scope) if (registration.scopeURL != scope)
return; return;
for (let version of registration.versions.values()) { for (let version of registration.versions.values()) {
if (step == 0 && version.isRunning() && version.isActivated()) { if (step == 0 && version.isRunning() && version.isActivated()) {
++step; ++step;
firstVersionId = version.id; firstVersionId = version.id;
TestRunner.addResult('The first ServiceWorker is activated.'); TestRunner.addResult('The first ServiceWorker is activated.');
TestRunner.addResult('==== ServiceWorkersView ===='); TestRunner.addResult('==== ServiceWorkersView ====');
TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope])); TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope]));
TestRunner.addResult('============================'); TestRunner.addResult('============================');
TestRunner.addIframe(scope, {id: frameId}); TestRunner.addIframe(scope, {id: frameId});
} else if (step == 1 && version.isRunning() && version.isInstalled()) { } else if (step == 1 && version.isRunning() && version.isInstalled()) {
++step;
secondVersionId = version.id;
TestRunner.addResult('The second Serviceworker is installed.');
TestRunner.addResult('==== ServiceWorkersView ====');
TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope]));
TestRunner.addResult('============================');
TestRunner.evaluateInPagePromise(`document.getElementById('${frameId}').remove();`);
}
}
if (step != 2)
return;
const firstVersion = registration.versions.get(firstVersionId);
const secondVersion = registration.versions.get(secondVersionId);
if ((!firstVersion || (firstVersion.isStopped() && firstVersion.isRedundant())) &&
secondVersion.isActivated() && secondVersion.isRunning()) {
++step; ++step;
TestRunner.addResult('The first ServiceWorker worker became redundant and stopped.'); secondVersionId = version.id;
TestRunner.addResult('The second Serviceworker is installed.');
TestRunner.addResult('==== ServiceWorkersView ===='); TestRunner.addResult('==== ServiceWorkersView ====');
TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope])); TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope]));
TestRunner.addResult('============================'); TestRunner.addResult('============================');
TestRunner.flushResults(); TestRunner.evaluateInPagePromise(`document.getElementById('${frameId}').remove();`);
TestRunner.evaluateInPage('reopenFrontend()');
} }
} }
UI.panels.resources._sidebar.serviceWorkersTreeElement.select(); if (step != 2)
ApplicationTestRunner.registerServiceWorker(scriptURL, scope); return;
} else { const firstVersion = registration.versions.get(firstVersionId);
TestRunner.addResult('DevTools frontend is reopened.'); const secondVersion = registration.versions.get(secondVersionId);
UI.panels.resources._sidebar.serviceWorkersTreeElement.select(); if ((!firstVersion || (firstVersion.isStopped() && firstVersion.isRedundant())) &&
TestRunner.addResult('==== ServiceWorkersView ===='); secondVersion.isActivated() && secondVersion.isRunning()) {
TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope])); ++step;
TestRunner.addResult('============================'); TestRunner.addResult('The first ServiceWorker worker became redundant and stopped.');
ApplicationTestRunner.deleteServiceWorkerRegistration(scope); TestRunner.addResult('==== ServiceWorkersView ====');
TestRunner.completeTest(); TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope]));
TestRunner.addResult('============================');
TestRunner.flushResults();
TestRunner.evaluateInPage('reopenFrontend()');
}
} }
}); UI.panels.resources._sidebar.serviceWorkersTreeElement.select();
ApplicationTestRunner.registerServiceWorker(scriptURL, scope);
} else {
TestRunner.addResult('DevTools frontend is reopened.');
UI.panels.resources._sidebar.serviceWorkersTreeElement.select();
TestRunner.addResult('==== ServiceWorkersView ====');
TestRunner.addResult(ApplicationTestRunner.dumpServiceWorkersView([scope]));
TestRunner.addResult('============================');
ApplicationTestRunner.deleteServiceWorkerRegistration(scope);
TestRunner.completeTest();
}
} }
</script> </script>
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
async function step4() { async function step4() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
} }
})(); })();
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
async function step10() { async function step10() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
} }
})(); })();
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
async function step4() { async function step4() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
} }
})(); })();
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
async function step6() { async function step6() {
const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)'); const output = await TestRunner.evaluateInPageAsync('JSON.stringify(self._output)');
TestRunner.addResults(JSON.parse(output.value)); TestRunner.addResults(JSON.parse(output));
TestRunner.completeTest(); TestRunner.completeTest();
} }
})(); })();
...@@ -117,28 +117,26 @@ ...@@ -117,28 +117,26 @@
end(); end();
} }
function performStandardTestCase(pageExpression, next) { async function performStandardTestCase(pageExpression, next) {
TestRunner.evaluateInPage(pageExpression, didEvaluate); var remote = await TestRunner.evaluateInPageRemoteObject(pageExpression);
async function didEvaluate(remote) { TestRunner.addResult(pageExpression + ' type = ' + remote.type);
TestRunner.addResult(pageExpression + ' type = ' + remote.type); var response =
var response = await TestRunner.RuntimeAgent.invoke_getProperties({objectId: remote.objectId, isOwnProperty: false});
await TestRunner.RuntimeAgent.invoke_getProperties({objectId: remote.objectId, isOwnProperty: false});
var propertiesMap = new Map();
var propertiesMap = new Map(); for (var prop of response.internalProperties)
for (var prop of response.internalProperties) propertiesMap.set(prop.name, prop);
propertiesMap.set(prop.name, prop); for (var prop of response.result) {
for (var prop of response.result) { if (prop.name === 'name' && prop.value && prop.value.type === 'string')
if (prop.name === 'name' && prop.value && prop.value.type === 'string') propertiesMap.set('name', prop);
propertiesMap.set('name', prop); if (prop.name === 'displayName' && prop.value && prop.value.type === 'string') {
if (prop.name === 'displayName' && prop.value && prop.value.type === 'string') { propertiesMap.set('name', prop);
propertiesMap.set('name', prop); break;
break;
}
} }
dumpFunctionDetails(propertiesMap);
loadAndDumpScopeObjects(propertiesMap.get('[[Scopes]]'), next);
} }
dumpFunctionDetails(propertiesMap);
loadAndDumpScopeObjects(propertiesMap.get('[[Scopes]]'), next);
} }
SourcesTestRunner.runDebuggerTestSuite([ SourcesTestRunner.runDebuggerTestSuite([
......
...@@ -35,13 +35,11 @@ ...@@ -35,13 +35,11 @@
var panel = UI.panels.sources; var panel = UI.panels.sources;
function performStandardTestCase(pageExpression, next) { async function performStandardTestCase(pageExpression, next) {
TestRunner.addSniffer(panel, 'showUISourceCode', showUISourceCodeHook); TestRunner.addSniffer(panel, 'showUISourceCode', showUISourceCodeHook);
TestRunner.evaluateInPage(pageExpression, didEvaluate); var remote = await TestRunner.evaluateInPageRemoteObject(pageExpression);
function didEvaluate(remote) { remote.getOwnPropertiesPromise().then(revealLocation.bind(null, remote));
remote.getOwnPropertiesPromise().then(revealLocation.bind(null, remote));
}
function revealLocation(remote, properties) { function revealLocation(remote, properties) {
var loc; var loc;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
} }
function step1(loc) { function step1(loc) {
TestRunner.addResult('window.location: ' + loc.description); TestRunner.addResult('window.location: ' + loc);
SourcesTestRunner.showScriptSource('inline-scripts.html', step2); SourcesTestRunner.showScriptSource('inline-scripts.html', step2);
} }
......
...@@ -22,11 +22,8 @@ ...@@ -22,11 +22,8 @@
didEditScriptSource); didEditScriptSource);
} }
function didEditScriptSource() { async function didEditScriptSource() {
TestRunner.evaluateInPage('f()', didEvaluateInPage); var result = await TestRunner.evaluateInPageRemoteObject('f()');
}
function didEvaluateInPage(result) {
TestRunner.assertEquals( TestRunner.assertEquals(
'live-edited string', result.description, 'live-edited string', result.description,
'edited function returns wrong result'); 'edited function returns wrong result');
...@@ -52,9 +49,12 @@ ...@@ -52,9 +49,12 @@
SourcesTestRunner.showScriptSource( SourcesTestRunner.showScriptSource(
'edit-me-when-paused.js', didShowScriptSource); 'edit-me-when-paused.js', didShowScriptSource);
function didShowScriptSource(sourceFrame) { async function didShowScriptSource(sourceFrame) {
SourcesTestRunner.waitUntilPaused(paused); SourcesTestRunner.waitUntilPaused(paused);
TestRunner.evaluateInPage('f1()', didEvaluateInPage); var result = await TestRunner.evaluateInPageRemoteObject('f1()');
TestRunner.assertEquals(
'3', result.description, 'edited function returns wrong result');
next();
} }
function paused(callFrames) { function paused(callFrames) {
...@@ -66,12 +66,6 @@ ...@@ -66,12 +66,6 @@
function didEditScriptSource() { function didEditScriptSource() {
SourcesTestRunner.resumeExecution(); SourcesTestRunner.resumeExecution();
} }
function didEvaluateInPage(result) {
TestRunner.assertEquals(
'3', result.description, 'edited function returns wrong result');
next();
}
}, },
function testNoCrashWhenOnlyOneFunctionOnStack(next) { function testNoCrashWhenOnlyOneFunctionOnStack(next) {
......
...@@ -300,10 +300,10 @@ function showInspectorAndRunTest() ...@@ -300,10 +300,10 @@ function showInspectorAndRunTest()
} }
</script> </script>
<script> <script>
function test() { async function test() {
TestRunner.hideInspectorView(); TestRunner.hideInspectorView();
TestRunner.evaluateInPage('globals.length', loopOverGlobals.bind(this, 0)); var total = await TestRunner.evaluateInPageRemoteObject('globals.length');
loopOverGlobals(0, total);
function loopOverGlobals(current, total) { function loopOverGlobals(current, total) {
function advance() { function advance() {
var next = current + 1; var next = current + 1;
......
...@@ -27,23 +27,23 @@ async function test() { ...@@ -27,23 +27,23 @@ async function test() {
var result = await TestRunner.RuntimeAgent.evaluate('window.objectId'); var result = await TestRunner.RuntimeAgent.evaluate('window.objectId');
if (result.type !== 'string') { if (result.type !== 'string') {
TestRunner.evaluateInPage('console.log(\'Opening front-end for the first time\')'); TestRunner.evaluateInPageAnonymously('console.log(\'Opening front-end for the first time\')');
result = await TestRunner.RuntimeAgent.evaluate(`({ handle : "handle" })`); result = await TestRunner.RuntimeAgent.evaluate(`({ handle : "handle" })`);
checkHandleInInjectedScript(result.objectId, reopenInspector); checkHandleInInjectedScript(result.objectId, reopenInspector);
} else { } else {
TestRunner.evaluateInPage('console.log(\'Opening front-end second time\')'); TestRunner.evaluateInPageAnonymously('console.log(\'Opening front-end second time\')');
checkHandleInInjectedScript(result.value, TestRunner.completeTest); checkHandleInInjectedScript(result.value, TestRunner.completeTest);
} }
function reopenInspector() { function reopenInspector() {
TestRunner.evaluateInPage('reopenWebInspector(\'' + escape(result.objectId) + '\')'); TestRunner.evaluateInPageAnonymously('reopenWebInspector(\'' + escape(result.objectId) + '\')');
} }
async function checkHandleInInjectedScript(objectId, callback) { async function checkHandleInInjectedScript(objectId, callback) {
var properties = await TestRunner.RuntimeAgent.getProperties(objectId, false); var properties = await TestRunner.RuntimeAgent.getProperties(objectId, false);
TestRunner.evaluateInPage( var result = await TestRunner.evaluateInPageRemoteObject(
!properties ? 'console.log(\'Error resolving object\')' : 'console.log(\'Resolved object successfully\')', !properties ? 'console.log(\'Error resolving object\')' : 'console.log(\'Resolved object successfully\')');
callback); callback(result);
} }
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
function assertAutosizingResult(expected, callback) { function assertAutosizingResult(expected, callback) {
function resultCallback(jsonResult) { function resultCallback(jsonResult) {
var result = JSON.parse(jsonResult.value); var result = JSON.parse(jsonResult);
var actual = result.textHeight > 200; var actual = result.textHeight > 200;
TestRunner.addResult( TestRunner.addResult(
'Text ' + (actual ? 'was' : 'was not') + ' autosized. ' + (expected == actual ? 'PASS' : 'FAIL')); 'Text ' + (actual ? 'was' : 'was not') + ' autosized. ' + (expected == actual ? 'PASS' : 'FAIL'));
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
TestRunner.evaluateInPage('navigator.userAgent', step2); TestRunner.evaluateInPage('navigator.userAgent', step2);
function step2(result) { function step2(result) {
TestRunner.addResult(result.value); TestRunner.addResult(result);
TestRunner.completeTest(); TestRunner.completeTest();
} }
})(); })();
...@@ -50,7 +50,20 @@ InspectorTest.evaluateInPage = async function(code, callback) ...@@ -50,7 +50,20 @@ InspectorTest.evaluateInPage = async function(code, callback)
objectGroup: "console" objectGroup: "console"
}); });
if (!response[Protocol.Error]) if (!response[Protocol.Error])
InspectorTest.safeWrap(callback)(InspectorTest.runtimeModel.createRemoteObject(response.result), response.exceptionDetails); InspectorTest.safeWrap(callback)(response.result.value, response.exceptionDetails);
}
/**
* TestRunner.evaluateInPageRemoteObject inserts sourceURL by inspecting the call stack.
*/
InspectorTest.evaluateInPageRemoteObject = async function(code, callback)
{
var response = await InspectorTest.RuntimeAgent.invoke_evaluate({
expression: code,
objectGroup: "console"
});
if (!response[Protocol.Error])
return InspectorTest.runtimeModel.createRemoteObject(response.result);
} }
InspectorTest.addResult = function(text) InspectorTest.addResult = function(text)
......
...@@ -351,14 +351,33 @@ TestRunner._setupTestHelpers = function(target) { ...@@ -351,14 +351,33 @@ TestRunner._setupTestHelpers = function(target) {
TestRunner.mainTarget = target; TestRunner.mainTarget = target;
}; };
/**
* @param {string} code
* @return {!Promise<*>}
*/
TestRunner.evaluateInPageRemoteObject = async function(code) {
var response = await TestRunner._evaluateInPage(code);
return TestRunner.runtimeModel.createRemoteObject(response.result);
};
/**
* @param {string} code
* @param {function(*, !Protocol.Runtime.ExceptionDetails=):void} callback
*/
TestRunner.evaluateInPage = async function(code, callback) {
var response = await TestRunner._evaluateInPage(code);
TestRunner.safeWrap(callback)(response.result.value, response.exceptionDetails);
};
/** @type {number} */ /** @type {number} */
TestRunner._evaluateInPageCounter = 0; TestRunner._evaluateInPageCounter = 0;
/** /**
* @param {string|!Function} code * @param {string} code
* @param {!Function} callback * @return {!Promise<{response: !SDK.RemoteObject,
* exceptionDetails: (!Protocol.Runtime.ExceptionDetails|undefined)}>}
*/ */
TestRunner.evaluateInPage = async function(code, callback) { TestRunner._evaluateInPage = async function(code) {
var lines = new Error().stack.split('at '); var lines = new Error().stack.split('at ');
// Handles cases where the function is safe wrapped // Handles cases where the function is safe wrapped
...@@ -374,22 +393,25 @@ TestRunner.evaluateInPage = async function(code, callback) { ...@@ -374,22 +393,25 @@ TestRunner.evaluateInPage = async function(code, callback) {
if (code.indexOf('sourceURL=') === -1) if (code.indexOf('sourceURL=') === -1)
code += `//# sourceURL=${sourceURL}`; code += `//# sourceURL=${sourceURL}`;
var response = await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'}); var response = await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'});
if (!response[Protocol.Error]) { var error = response[Protocol.Error];
TestRunner.safeWrap(callback)( if (error) {
TestRunner.runtimeModel.createRemoteObject(response.result), response.exceptionDetails); TestRunner.addResult('Error: ' + error);
TestRunner.completeTest();
return;
} }
return response;
}; };
/** /**
* Doesn't append sourceURL to snippets evaluated in inspected page * Doesn't append sourceURL to snippets evaluated in inspected page
* to avoid churning test expectations * to avoid churning test expectations
* @param {string} code * @param {string} code
* @return {!Promise<undefined>} * @return {!Promise<*>}
*/ */
TestRunner.evaluateInPageAnonymously = async function(code) { TestRunner.evaluateInPageAnonymously = async function(code) {
var response = await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'}); var response = await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'});
if (!response[Protocol.Error]) if (!response[Protocol.Error])
return Promise.resolve(); return response.result.value;
TestRunner.addResult( TestRunner.addResult(
'Error: ' + 'Error: ' +
(response.exceptionDetails && response.exceptionDetails.text || 'exception from evaluateInPageAnonymously.')); (response.exceptionDetails && response.exceptionDetails.text || 'exception from evaluateInPageAnonymously.'));
...@@ -397,8 +419,8 @@ TestRunner.evaluateInPageAnonymously = async function(code) { ...@@ -397,8 +419,8 @@ TestRunner.evaluateInPageAnonymously = async function(code) {
}; };
/** /**
* @param {string|!Function} code * @param {string} code
* @return {!Promise<!SDK.RemoteObject>} * @return {!Promise<*>}
*/ */
TestRunner.evaluateInPagePromise = function(code) { TestRunner.evaluateInPagePromise = function(code) {
return new Promise(success => TestRunner.evaluateInPage(code, success)); return new Promise(success => TestRunner.evaluateInPage(code, success));
...@@ -406,7 +428,7 @@ TestRunner.evaluateInPagePromise = function(code) { ...@@ -406,7 +428,7 @@ TestRunner.evaluateInPagePromise = function(code) {
/** /**
* @param {string} code * @param {string} code
* @return {!Promise<!SDK.RemoteObject|undefined>} * @return {!Promise<*>}
*/ */
TestRunner.evaluateInPageAsync = async function(code) { TestRunner.evaluateInPageAsync = async function(code) {
var response = await TestRunner.RuntimeAgent.invoke_evaluate( var response = await TestRunner.RuntimeAgent.invoke_evaluate(
...@@ -414,7 +436,7 @@ TestRunner.evaluateInPageAsync = async function(code) { ...@@ -414,7 +436,7 @@ TestRunner.evaluateInPageAsync = async function(code) {
var error = response[Protocol.Error]; var error = response[Protocol.Error];
if (!error && !response.exceptionDetails) if (!error && !response.exceptionDetails)
return TestRunner.runtimeModel.createRemoteObject(response.result); return response.result.value;
TestRunner.addResult( TestRunner.addResult(
'Error: ' + 'Error: ' +
(error || response.exceptionDetails && response.exceptionDetails.text || 'exception while evaluation in page.')); (error || response.exceptionDetails && response.exceptionDetails.text || 'exception while evaluation in page.'));
...@@ -424,7 +446,7 @@ TestRunner.evaluateInPageAsync = async function(code) { ...@@ -424,7 +446,7 @@ TestRunner.evaluateInPageAsync = async function(code) {
/** /**
* @param {string} name * @param {string} name
* @param {!Array<*>} args * @param {!Array<*>} args
* @return {!Promise<!SDK.RemoteObject|undefined>} * @return {!Promise<*>}
*/ */
TestRunner.callFunctionInPageAsync = function(name, args) { TestRunner.callFunctionInPageAsync = function(name, args) {
args = args || []; args = args || [];
...@@ -483,7 +505,7 @@ TestRunner.deprecatedRunAfterPendingDispatches = function(callback) { ...@@ -483,7 +505,7 @@ TestRunner.deprecatedRunAfterPendingDispatches = function(callback) {
* are relative to the test file and not the inspected page * are relative to the test file and not the inspected page
* (i.e. http/tests/devtools/resources/inspected-page.html). * (i.e. http/tests/devtools/resources/inspected-page.html).
* @param {string} html * @param {string} html
* @return {!Promise<undefined>} * @return {!Promise<*>}
*/ */
TestRunner.loadHTML = function(html) { TestRunner.loadHTML = function(html) {
if (!html.includes('<base')) { if (!html.includes('<base')) {
...@@ -501,7 +523,7 @@ TestRunner.loadHTML = function(html) { ...@@ -501,7 +523,7 @@ TestRunner.loadHTML = function(html) {
/** /**
* @param {string} path * @param {string} path
* @return {!Promise<!SDK.RemoteObject|undefined>} * @return {!Promise<*>}
*/ */
TestRunner.addScriptTag = function(path) { TestRunner.addScriptTag = function(path) {
return TestRunner.evaluateInPageAsync(` return TestRunner.evaluateInPageAsync(`
...@@ -516,7 +538,7 @@ TestRunner.addScriptTag = function(path) { ...@@ -516,7 +538,7 @@ TestRunner.addScriptTag = function(path) {
/** /**
* @param {string} path * @param {string} path
* @return {!Promise<!SDK.RemoteObject|undefined>} * @return {!Promise<*>}
*/ */
TestRunner.addStylesheetTag = function(path) { TestRunner.addStylesheetTag = function(path) {
return TestRunner.evaluateInPageAsync(` return TestRunner.evaluateInPageAsync(`
...@@ -541,7 +563,7 @@ TestRunner.addStylesheetTag = function(path) { ...@@ -541,7 +563,7 @@ TestRunner.addStylesheetTag = function(path) {
/** /**
* @param {string} path * @param {string} path
* @param {!Object|undefined} options * @param {!Object|undefined} options
* @return {!Promise<!SDK.RemoteObject|undefined>} * @return {!Promise<*>}
*/ */
TestRunner.addIframe = function(path, options = {}) { TestRunner.addIframe = function(path, options = {}) {
options.id = options.id || ''; options.id = options.id || '';
...@@ -1279,8 +1301,8 @@ TestRunner._printDevToolsConsole = function() { ...@@ -1279,8 +1301,8 @@ TestRunner._printDevToolsConsole = function() {
* @param {string} querySelector * @param {string} querySelector
*/ */
TestRunner.dumpInspectedPageElementText = async function(querySelector) { TestRunner.dumpInspectedPageElementText = async function(querySelector) {
var remoteObject = await TestRunner.evaluateInPageAsync(`document.querySelector('${querySelector}').innerText`); var value = await TestRunner.evaluateInPageAsync(`document.querySelector('${querySelector}').innerText`);
TestRunner.addResult(remoteObject.value); TestRunner.addResult(value);
}; };
/** @type {boolean} */ /** @type {boolean} */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment