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 | |
68 InspectorTest.sendCommand(command, properties || {}, commandCallback); | 65 InspectorTest.sendCommand(command, properties || {}, commandCallback); |
69 function commandCallback(msg) | 66 function commandCallback(msg) |
70 { | 67 { |
71 if (msg.error) { | 68 if (msg.error) { |
72 InspectorTest.log("ERROR: " + msg.error.message); | 69 InspectorTest.log("ERROR: " + msg.error.message); |
73 InspectorTest.completeTest(); | 70 InspectorTest.completeTest(); |
74 return; | 71 return; |
75 } | 72 } |
76 if (callback) | 73 if (callback) |
77 callback(msg.result); | 74 callback(msg.result); |
78 fulfill(msg.result); | |
79 } | 75 } |
80 return result; | |
81 } | 76 } |
82 | 77 |
83 InspectorTest.sendCommandPromise = function(method, params) | 78 InspectorTest.sendCommandPromise = function(method, params) |
84 { | 79 { |
85 var callback; | 80 var callback; |
86 var promise = new Promise(fulfill => callback = fulfill); | 81 var promise = new Promise(fulfill => callback = fulfill); |
87 InspectorTest.sendCommand(method, params, callback); | 82 InspectorTest.sendCommand(method, params, callback); |
88 return promise; | 83 return promise; |
89 } | 84 } |
90 | 85 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 callback(); | 435 callback(); |
441 } | 436 } |
442 } | 437 } |
443 } | 438 } |
444 | 439 |
445 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); | 440 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); |
446 | 441 |
447 </script> | 442 </script> |
448 </head> | 443 </head> |
449 </html> | 444 </html> |
OLD | NEW |