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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 if (InspectorTest._dumpInspectorProtocolMessages) | 56 if (InspectorTest._dumpInspectorProtocolMessages) |
57 testRunner.logToStderr("frontend: " + JSON.stringify(messageObject)); | 57 testRunner.logToStderr("frontend: " + JSON.stringify(messageObject)); |
58 var embedderMessage = { "id": ++this._embedderRequestId, "method": "dispatch
ProtocolMessage", "params": [JSON.stringify(messageObject)] }; | 58 var embedderMessage = { "id": ++this._embedderRequestId, "method": "dispatch
ProtocolMessage", "params": [JSON.stringify(messageObject)] }; |
59 DevToolsHost.sendMessageToEmbedder(JSON.stringify(embedderMessage)); | 59 DevToolsHost.sendMessageToEmbedder(JSON.stringify(embedderMessage)); |
60 return this._requestId; | 60 return this._requestId; |
61 } | 61 } |
62 | 62 |
63 InspectorTest.sendCommandOrDie = function(command, properties, callback) | 63 InspectorTest.sendCommandOrDie = function(command, properties, callback) |
64 { | 64 { |
| 65 var fulfill; |
| 66 var result = new Promise(f => fulfill = f); |
| 67 |
65 InspectorTest.sendCommand(command, properties || {}, commandCallback); | 68 InspectorTest.sendCommand(command, properties || {}, commandCallback); |
66 function commandCallback(msg) | 69 function commandCallback(msg) |
67 { | 70 { |
68 if (msg.error) { | 71 if (msg.error) { |
69 InspectorTest.log("ERROR: " + msg.error.message); | 72 InspectorTest.log("ERROR: " + msg.error.message); |
70 InspectorTest.completeTest(); | 73 InspectorTest.completeTest(); |
71 return; | 74 return; |
72 } | 75 } |
73 if (callback) | 76 if (callback) |
74 callback(msg.result); | 77 callback(msg.result); |
| 78 fulfill(msg.result); |
75 } | 79 } |
| 80 return result; |
76 } | 81 } |
77 | 82 |
78 InspectorTest.sendCommandPromise = function(method, params) | 83 InspectorTest.sendCommandPromise = function(method, params) |
79 { | 84 { |
80 var callback; | 85 var callback; |
81 var promise = new Promise(fulfill => callback = fulfill); | 86 var promise = new Promise(fulfill => callback = fulfill); |
82 InspectorTest.sendCommand(method, params, callback); | 87 InspectorTest.sendCommand(method, params, callback); |
83 return promise; | 88 return promise; |
84 } | 89 } |
85 | 90 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 callback(); | 440 callback(); |
436 } | 441 } |
437 } | 442 } |
438 } | 443 } |
439 | 444 |
440 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); | 445 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); |
441 | 446 |
442 </script> | 447 </script> |
443 </head> | 448 </head> |
444 </html> | 449 </html> |
OLD | NEW |