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

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

Issue 659813002: Apply updates to static methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix types. 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/pkg/dart2js_incremental/lib/library_updater.dart ('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;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (closure == null) { 88 if (closure == null) {
89 print('[closure] is null.'); 89 print('[closure] is null.');
90 closure = foo; 90 closure = foo;
91 } 91 }
92 closure('a'); 92 closure('a');
93 closure('a', 'c'); 93 closure('a', 'c');
94 } 94 }
95 """, 95 """,
96 const <String> ['b a', 'c a']), 96 const <String> ['b a', 'c a']),
97 ], 97 ],
98
99 // Test modifying a static method works.
100 const <ProgramResult>[
101 const ProgramResult(
102 """
103 class C {
104 static m() {
105 print('v1');
106 }
107 }
108 main() {
109 C.m();
110 }
111 """,
112 const <String> ['v1']),
113 const ProgramResult(
114 """
115 class C {
116 static m() {
117 print('v2');
118 }
119 }
120 main() {
121 C.m();
122 }
123 """,
124 const <String> ['v2']),
125 ],
126
127 // Test modifying an instance method works.
128 const <ProgramResult>[
129 const ProgramResult(
130 """
131 class C {
132 m() {
133 print('v1');
134 }
135 }
136 var instance;
137 main() {
138 if (instance == null) {
139 instance = new C();
140 }
141 instance.m();
142 }
143 """,
144 const <String> ['v1']),
145 const ProgramResult(
146 """
147 class C {
148 m() {
149 print('v2');
150 }
151 }
152 var instance;
153 main() {
154 if (instance == null) {
155 instance = new C();
156 }
157 instance.m();
158 }
159 """,
160 // TODO(ahe): This test is failing, should print "v2".
161 const <String> ['v1']),
162 ],
98 ]; 163 ];
99 164
100
101 void main() { 165 void main() {
102 listener.start(); 166 listener.start();
103 167
104 return asyncTest(() => Future.forEach(tests, compileAndRun)); 168 return asyncTest(() => Future.forEach(tests, compileAndRun));
105 } 169 }
106 170
107 Future compileAndRun(List<ProgramResult> programs) { 171 Future compileAndRun(List<ProgramResult> programs) {
108 var status = new DivElement(); 172 var status = new DivElement();
109 document.body.append(status); 173 document.body.append(status);
110 174
(...skipping 21 matching lines...) Expand all
132 int version = 2; 196 int version = 2;
133 return Future.forEach(programs.skip(1), (ProgramResult program) { 197 return Future.forEach(programs.skip(1), (ProgramResult program) {
134 198
135 status.append(new PreElement()..appendText(program.code)); 199 status.append(new PreElement()..appendText(program.code));
136 200
137 WebInputProvider inputProvider = 201 WebInputProvider inputProvider =
138 test.incrementalCompiler.inputProvider; 202 test.incrementalCompiler.inputProvider;
139 Uri uri = test.scriptUri.resolve('?v${version++}'); 203 Uri uri = test.scriptUri.resolve('?v${version++}');
140 inputProvider.cachedSources[uri] = new Future.value(program.code); 204 inputProvider.cachedSources[uri] = new Future.value(program.code);
141 Future future = test.incrementalCompiler.compileUpdates( 205 Future future = test.incrementalCompiler.compileUpdates(
142 {test.scriptUri: uri}); 206 {test.scriptUri: uri}, logVerbose: print, logTime: print);
143 return future.then((String update) { 207 return future.then((String update) {
208 print({'update': update});
144 iframe.contentWindow.postMessage(['apply-update', update], '*'); 209 iframe.contentWindow.postMessage(['apply-update', update], '*');
145 210
146 return listener.expect( 211 return listener.expect(
147 program.messagesWith('iframe-dart-updated-main-done')); 212 program.messagesWith('iframe-dart-updated-main-done'));
148 }); 213 });
149 }); 214 });
150 }); 215 });
151 }); 216 });
152 }).then((_) { 217 }).then((_) {
153 status.style.color = 'limegreen'; 218 status.style.color = 'limegreen';
154 219
155 // Remove the iframe to work around a bug in test.dart. 220 // Remove the iframe to work around a bug in test.dart.
156 iframe.remove(); 221 iframe.remove();
157 }); 222 });
158 } 223 }
OLDNEW
« no previous file with comments | « dart/pkg/dart2js_incremental/lib/library_updater.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698