Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: dart/tests/try/web/incremental_compilation_update_test.dart

Issue 641143002: Perform incremental compilation, and run the updated program. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r41074. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/tests/try/web/incremental_compilation_update.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library trydart.incremental_compilation_update_test; 5 library trydart.incremental_compilation_update_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 8
9 import 'dart:async' show 9 import 'dart:async' show
10 Future; 10 Future;
11 11
12 import 'package:async_helper/async_helper.dart' show 12 import 'package:async_helper/async_helper.dart' show
13 asyncTest; 13 asyncTest;
14 14
15 import 'sandbox.dart' show 15 import 'sandbox.dart' show
16 appendIFrame, 16 appendIFrame,
17 listener; 17 listener;
18 18
19 import 'web_compiler_test_case.dart' show 19 import 'web_compiler_test_case.dart' show
20 WebCompilerTestCase; 20 WebCompilerTestCase,
21 WebInputProvider;
21 22
22 void main() => asyncTest(() { 23 void main() => asyncTest(() {
23 listener.start(); 24 listener.start();
24 25
25 IFrameElement iframe = 26 IFrameElement iframe =
26 appendIFrame( 27 appendIFrame(
27 '/root_dart/tests/try/web/incremental_compilation_update.html', 28 '/root_dart/tests/try/web/incremental_compilation_update.html',
28 document.body) 29 document.body)
29 ..style.width = '90vw' 30 ..style.width = '90vw'
30 ..style.height = '90vh'; 31 ..style.height = '90vh';
31 32
32 return listener.expect('iframe-ready').then((_) { 33 return listener.expect('iframe-ready').then((_) {
33 Future<String> future = 34 WebCompilerTestCase test =
34 new WebCompilerTestCase("main() { print('Hello, World!'); }").run(); 35 new WebCompilerTestCase("main() { print('Hello, World!'); }");
35 return future.then((String jsCode) { 36 return test.run().then((String jsCode) {
36 var objectUrl = 37 var objectUrl =
37 Url.createObjectUrl(new Blob([jsCode], 'application/javascript')); 38 Url.createObjectUrl(new Blob([jsCode], 'application/javascript'));
38 39
39 iframe.contentWindow.postMessage(['add-script', objectUrl], '*'); 40 iframe.contentWindow.postMessage(['add-script', objectUrl], '*');
40 return listener.expect(['Hello, World!', 'iframe-dart-main-done']).then( 41 return listener.expect(['Hello, World!', 'iframe-dart-main-done']).then(
41 (_) { 42 (_) {
42 // TODO(ahe): Add incremental compilation here. 43 WebInputProvider inputProvider =
44 test.incrementalCompiler.inputProvider;
45 Uri uri = test.scriptUri.resolve('?v2');
46 inputProvider.cachedSources[uri] = new Future.value(
47 "main() { print('Hello, Brave New World!'); }");
48 Future future = test.incrementalCompiler.compileUpdates(
49 {test.scriptUri: uri});
50 return future.then((String update) {
51 iframe.contentWindow.postMessage(['apply-update', update], '*');
52
53 return listener.expect(
54 ['Hello, Brave New World!',
55 'iframe-dart-updated-main-done']);
56 });
43 }); 57 });
44 }); 58 });
45 }).then((_) { 59 }).then((_) {
46 // Remove the iframe to work around a bug in test.dart. 60 // Remove the iframe to work around a bug in test.dart.
47 iframe.remove(); 61 iframe.remove();
48 }); 62 });
49 }); 63 });
OLDNEW
« no previous file with comments | « dart/tests/try/web/incremental_compilation_update.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698