| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 InspectorTest.evaluateInPage = function(string, callback) | 268 InspectorTest.evaluateInPage = function(string, callback) |
| 269 { | 269 { |
| 270 this.sendCommand("Runtime.evaluate", { "expression": string }, function(mess
age) { | 270 this.sendCommand("Runtime.evaluate", { "expression": string }, function(mess
age) { |
| 271 if (message.error) | 271 if (message.error) |
| 272 InspectorTest.log("Error while executing '" + string + "': " + messa
ge.error.message); | 272 InspectorTest.log("Error while executing '" + string + "': " + messa
ge.error.message); |
| 273 else if (callback) | 273 else if (callback) |
| 274 callback(message.result.result.value); | 274 callback(message.result.result.value); |
| 275 }); | 275 }); |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 InspectorTest._asyncCallbacks = {}; |
| 279 InspectorTest._asyncCallbackId = 0; |
| 280 |
| 281 InspectorTest.evaluateInPageAsync = function(string, callback) |
| 282 { |
| 283 var id = ++InspectorTest._asyncCallbackId; |
| 284 InspectorTest._asyncCallbacks[id] = callback; |
| 285 var callbackString = "testRunner.evaluateInWebInspector.bind(testRunner, 42,
\"InspectorTest._evaluateInPageAsyncCompleted(" + id + ")\")"; |
| 286 var code = string.replace("%callback", callbackString); |
| 287 InspectorTest.evaluateInPage(code); |
| 288 }; |
| 289 |
| 290 InspectorTest._evaluateInPageAsyncCompleted = function(id) |
| 291 { |
| 292 var callback = InspectorTest._asyncCallbacks[id]; |
| 293 delete InspectorTest._asyncCallbacks[id]; |
| 294 if (!callback) { |
| 295 InspectorTest.log("Error: no callback for async function"); |
| 296 InspectorTest.completeTest(); |
| 297 return; |
| 298 } |
| 299 callback(); |
| 300 } |
| 301 |
| 278 InspectorTest.completeTestIfError = function(messageObject) | 302 InspectorTest.completeTestIfError = function(messageObject) |
| 279 { | 303 { |
| 280 if (messageObject.error) { | 304 if (messageObject.error) { |
| 281 InspectorTest.log(messageObject.error.message); | 305 InspectorTest.log(messageObject.error.message); |
| 282 InspectorTest.completeTest(); | 306 InspectorTest.completeTest(); |
| 283 return true; | 307 return true; |
| 284 } | 308 } |
| 285 return false; | 309 return false; |
| 286 } | 310 } |
| 287 | 311 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 var callback = didResolve ? callbacks.resolve : callbacks.reject; | 422 var callback = didResolve ? callbacks.resolve : callbacks.reject; |
| 399 delete pendingPromiseEvalRequests[callId]; | 423 delete pendingPromiseEvalRequests[callId]; |
| 400 callback(value); | 424 callback(value); |
| 401 } | 425 } |
| 402 | 426 |
| 403 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); | 427 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); |
| 404 | 428 |
| 405 </script> | 429 </script> |
| 406 </head> | 430 </head> |
| 407 </html> | 431 </html> |
| OLD | NEW |