Index: third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js b/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js |
index 8743227abb8ef443d54b94a0781d9b416178b1a8..47038b2d4a2c8eed4a252e31a51fd9b319ced319 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js |
+++ b/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js |
@@ -45,6 +45,8 @@ IntegrationTestRunner._setupTestHelpers = function(target) { |
* @param {!Function} callback |
*/ |
TestRunner.evaluateInPage = async function(code, callback) { |
+ if (typeof code === 'function') |
+ code = `(${code.toString()})()`; |
luoe
2017/07/07 22:26:40
Neat
|
var response = await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'}); |
if (!response[Protocol.Error]) { |
TestRunner.safeWrap(callback)( |
@@ -69,6 +71,15 @@ TestRunner.deprecatedRunAfterPendingDispatches = function(callback) { |
Promise.all(promises).then(TestRunner.safeWrap(callback)); |
}; |
+/** |
+ * @param {string} html |
+ * @return {!Promise<!SDK.RemoteObject>} |
+ */ |
+TestRunner.loadHTML = function(html) { |
luoe
2017/07/07 22:26:40
It would be nice in the future if this aligned wit
chenwilliam
2017/07/10 21:14:35
This code is actually almost the same as page.load
|
+ html = html.replace(/'/g, '\\\'').replace(/\n/g, '\\n'); |
+ return TestRunner.evaluateInPagePromise(`document.write('${html}');document.close();`); |
+}; |
+ |
/** @type {boolean} */ |
IntegrationTestRunner._startedTest = false; |