Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 var initialize_InspectorTest = function() { | 27 var initialize_InspectorTest = function() { |
| 28 | 28 |
| 29 InspectorTest.evaluateInInspectedPage = function(expression, callback) | 29 InspectorTest.evaluateInInspectedPage = function(expression, callback) |
| 30 { | 30 { |
| 31 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression }, ca llback); | 31 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression }, ca llback); |
| 32 } | 32 } |
| 33 | 33 |
| 34 InspectorTest.runtimeEvaluatePromise = function(expression, objectGroup) | |
| 35 { | |
| 36 var callback; | |
| 37 var promise = new Promise(fulfill => callback = fulfill); | |
| 38 InspectorTest.sendCommand("Runtime.evaluate", { "expression": expression, "o bjectGroup": objectGroup }, callback); | |
|
dgozman
2016/07/28 00:07:56
Let's do sendCommandPromise
kozy
2016/07/28 22:54:08
Done.
| |
| 39 return promise; | |
| 40 } | |
| 41 | |
| 42 InspectorTest.runtimePromiseThenPromise = function(promiseObjectId, returnByValu e, generatePreview) | |
| 43 { | |
| 44 var callback; | |
| 45 var promise = new Promise(fulfill => callback = fulfill); | |
| 46 InspectorTest.sendCommand("Runtime.promiseThen", { "promiseObjectId": promis eObjectId, "returnByValue": returnByValue, "generatePreview": generatePreview }, callback); | |
| 47 return promise; | |
| 48 } | |
| 49 | |
| 50 InspectorTest.runtimeReleaseObjectPromise = function(objectId) | |
| 51 { | |
| 52 var callback; | |
| 53 var promise = new Promise(fulfill => callback = fulfill); | |
| 54 InspectorTest.sendCommand("Runtime.releaseObject", { "objectId": objectId }, callback); | |
| 55 return promise; | |
| 56 } | |
| 57 | |
| 34 } | 58 } |
| 35 | 59 |
| 36 var outputElement; | 60 var outputElement; |
| 37 | 61 |
| 38 /** | 62 /** |
| 39 * Logs message to process stdout via alert (hopefully implemented with immediat e flush). | 63 * Logs message to process stdout via alert (hopefully implemented with immediat e flush). |
| 40 * @param {string} text | 64 * @param {string} text |
| 41 */ | 65 */ |
| 42 function debugLog(text) | 66 function debugLog(text) |
| 43 { | 67 { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 continue; | 160 continue; |
| 137 initializers += "(" + window[symbol].toString() + ")();\n"; | 161 initializers += "(" + window[symbol].toString() + ")();\n"; |
| 138 } | 162 } |
| 139 evaluateInFrontend(initializers + "(" + testFunction.toString() +")();") ; | 163 evaluateInFrontend(initializers + "(" + testFunction.toString() +")();") ; |
| 140 return; | 164 return; |
| 141 } | 165 } |
| 142 // Kill waiting process if failed to send. | 166 // Kill waiting process if failed to send. |
| 143 alert("Failed to send test function"); | 167 alert("Failed to send test function"); |
| 144 testRunner.notifyDone(); | 168 testRunner.notifyDone(); |
| 145 } | 169 } |
| OLD | NEW |