OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library trydart.incremental_compilation_update_test; |
| 6 |
| 7 import 'dart:html'; |
| 8 |
| 9 import 'dart:async' show |
| 10 Future; |
| 11 |
| 12 import 'package:async_helper/async_helper.dart' show |
| 13 asyncTest; |
| 14 |
| 15 import 'sandbox.dart' show |
| 16 appendIFrame, |
| 17 listener; |
| 18 |
| 19 import 'web_compiler_test_case.dart' show |
| 20 WebCompilerTestCase; |
| 21 |
| 22 void main() => asyncTest(() { |
| 23 listener.start(); |
| 24 |
| 25 IFrameElement iframe = |
| 26 appendIFrame( |
| 27 '/root_dart/tests/try/web/incremental_compilation_update.html', |
| 28 document.body) |
| 29 ..style.width = '90vw' |
| 30 ..style.height = '90vh'; |
| 31 |
| 32 return listener.expect('iframe-ready').then((_) { |
| 33 Future<String> future = |
| 34 new WebCompilerTestCase("main() { print('Hello, World!'); }").run(); |
| 35 return future.then((String jsCode) { |
| 36 var objectUrl = |
| 37 Url.createObjectUrl(new Blob([jsCode], 'application/javascript')); |
| 38 |
| 39 iframe.contentWindow.postMessage(['add-script', objectUrl], '*'); |
| 40 return listener.expect(['Hello, World!', 'iframe-dart-main-done']).then( |
| 41 (_) { |
| 42 // TODO(ahe): Add incremental compilation here. |
| 43 }); |
| 44 }); |
| 45 }).then((_) { |
| 46 // Remove the iframe to work around a bug in test.dart. |
| 47 iframe.remove(); |
| 48 }); |
| 49 }); |
OLD | NEW |