| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This module provides the test page for WebUIMojoTest. Once the page is | 5 // This module provides the test page for WebUIMojoTest. Once the page is |
| 6 // loaded it sends "syn" message to the native code. Once page receives "ack" | 6 // loaded it sends "syn" message to the native code. Once page receives "ack" |
| 7 // from the native code, the page then sends "fin". Test succeeds only when | 7 // from the native code, the page then sends "fin". Test succeeds only when |
| 8 // "fin" is received by the native page. Refer to | 8 // "fin" is received by the native page. Refer to |
| 9 // ios/web/webui/web_ui_mojo_inttest.mm for testing code. | 9 // ios/web/webui/web_ui_mojo_inttest.mm for testing code. |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 * @return {!Promise} Fires when DOMContentLoaded event is received. | 49 * @return {!Promise} Fires when DOMContentLoaded event is received. |
| 50 */ | 50 */ |
| 51 function whenDomContentLoaded() { | 51 function whenDomContentLoaded() { |
| 52 return new Promise(function(resolve, reject) { | 52 return new Promise(function(resolve, reject) { |
| 53 document.addEventListener('DOMContentLoaded', resolve); | 53 document.addEventListener('DOMContentLoaded', resolve); |
| 54 }); | 54 }); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function main() { | 57 function main() { |
| 58 Promise.all([ | 58 Promise.all([ |
| 59 whenDomContentLoaded(), getBrowserProxy() | 59 getBrowserProxy(), whenDomContentLoaded() |
| 60 ]).then(function(results) { | 60 ]).then(function([browserProxy]) { |
| 61 var browserProxy = results[1]; | |
| 62 // Send "syn" so native code should reply with "ack". | 61 // Send "syn" so native code should reply with "ack". |
| 63 browserProxy.handleJsMessage('syn'); | 62 browserProxy.handleJsMessage('syn'); |
| 64 }); | 63 }); |
| 65 } | 64 } |
| 66 main(); | 65 main(); |
| OLD | NEW |