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 | 3 |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 1. Redistributions of source code must retain the above copyright | 8 1. Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 2. Redistributions in binary form must reproduce the above copyright | 10 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 InspectorTest.evaluateInPage = function(string, callback) | 291 InspectorTest.evaluateInPage = function(string, callback) |
| 292 { | 292 { |
| 293 this.sendCommand("Runtime.evaluate", { "expression": string }, function(mess age) { | 293 this.sendCommand("Runtime.evaluate", { "expression": string }, function(mess age) { |
| 294 if (message.error) | 294 if (message.error) |
| 295 InspectorTest.log("Error while executing '" + string + "': " + messa ge.error.message); | 295 InspectorTest.log("Error while executing '" + string + "': " + messa ge.error.message); |
| 296 else if (callback) | 296 else if (callback) |
| 297 callback(message.result.result.value); | 297 callback(message.result.result.value); |
| 298 }); | 298 }); |
| 299 }; | 299 }; |
| 300 | 300 |
| 301 /** | |
| 302 * Evaluates expression in page. | |
|
dgozman
2017/05/02 19:36:37
We don't add comments.
| |
| 303 * @param {string} expression | |
| 304 * @return {!Promise<?>} | |
| 305 */ | |
| 306 InspectorTest.evaluateInPagePromise = function(expression) | |
| 307 { | |
| 308 return InspectorTest.sendCommandPromise("Runtime.evaluate", { "expression": expression, awaitPromise: false, returnByValue: true }); | |
| 309 }; | |
| 310 | |
| 311 // Use this if the expression being ran in page is a promise. | |
| 301 InspectorTest.evaluateInPageAsync = function(expression) | 312 InspectorTest.evaluateInPageAsync = function(expression) |
| 302 { | 313 { |
| 303 return InspectorTest.sendCommandPromise("Runtime.evaluate", { "expression": expression, awaitPromise: true, returnByValue: true }).then((message) => message .result.result.value); | 314 return InspectorTest.sendCommandPromise("Runtime.evaluate", { "expression": expression, awaitPromise: true, returnByValue: true }).then((message) => message .result.result.value); |
| 304 } | 315 } |
| 305 | 316 |
| 306 InspectorTest.completeTestIfError = function(messageObject) | 317 InspectorTest.completeTestIfError = function(messageObject) |
| 307 { | 318 { |
| 308 if (messageObject.error) { | 319 if (messageObject.error) { |
| 309 InspectorTest.log(messageObject.error.message); | 320 InspectorTest.log(messageObject.error.message); |
| 310 InspectorTest.completeTest(); | 321 InspectorTest.completeTest(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 callback(); | 436 callback(); |
| 426 } | 437 } |
| 427 } | 438 } |
| 428 } | 439 } |
| 429 | 440 |
| 430 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest), false); | 441 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest), false); |
| 431 | 442 |
| 432 </script> | 443 </script> |
| 433 </head> | 444 </head> |
| 434 </html> | 445 </html> |
| OLD | NEW |