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

Side by Side Diff: dart/site/try/src/interaction_manager.dart

Issue 355953004: Change end_to_end_test so it doesn't time out due to V8 bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « no previous file | dart/tests/try/end_to_end_test.dart » ('j') | 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.interaction_manager; 5 library trydart.interaction_manager;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 8
9 import 'dart:convert' show 9 import 'dart:convert' show
10 JSON; 10 JSON;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // TODO(ahe): Remove this from InteractionManager, but not from InitialState. 167 // TODO(ahe): Remove this from InteractionManager, but not from InitialState.
168 void consolePrintLine(line); 168 void consolePrintLine(line);
169 169
170 /// Called just before running a freshly compiled program. 170 /// Called just before running a freshly compiled program.
171 void aboutToRun(); 171 void aboutToRun();
172 172
173 /// Called when an error occurs when running user code in an iframe. 173 /// Called when an error occurs when running user code in an iframe.
174 void onIframeError(ErrorMessage message); 174 void onIframeError(ErrorMessage message);
175 175
176 void verboseCompilerMessage(String message); 176 void verboseCompilerMessage(String message);
177
178 /// Called if the compiler crashes.
179 void onCompilerCrash(data);
180
181 /// Called if an internal error is detected.
182 void onInternalError(message);
177 } 183 }
178 184
179 /** 185 /**
180 * State machine for UI interactions. 186 * State machine for UI interactions.
181 */ 187 */
182 class InteractionContext extends InteractionManager { 188 class InteractionContext extends InteractionManager {
183 InteractionState state; 189 InteractionState state;
184 190
185 final Map<String, CompilationUnit> projectFiles = <String, CompilationUnit>{}; 191 final Map<String, CompilationUnit> projectFiles = <String, CompilationUnit>{};
186 192
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 try { 238 try {
233 return state.onMutation(mutations, observer); 239 return state.onMutation(mutations, observer);
234 } finally { 240 } finally {
235 // Discard any mutations during the observer, as these can lead to 241 // Discard any mutations during the observer, as these can lead to
236 // infinite loop. 242 // infinite loop.
237 observer.takeRecords(); 243 observer.takeRecords();
238 } 244 }
239 } catch (error, stackTrace) { 245 } catch (error, stackTrace) {
240 try { 246 try {
241 editor.isMalformedInput = true; 247 editor.isMalformedInput = true;
242 outputDiv 248 state.onInternalError(
243 ..nodes.clear() 249 '\nError and stack trace:\n$error\n$stackTrace\n');
244 ..append(new HeadingElement.h1()..appendText('Internal Error'))
245 ..appendText('We would appreciate if you take a moment to report '
246 'this at ')
247 ..append(
248 new AnchorElement(href: TRY_DART_NEW_DEFECT)
249 ..target = '_blank'
250 ..appendText(TRY_DART_NEW_DEFECT))
251 ..appendText('\nError and stack trace:\n$error\n')
252 ..appendText('$stackTrace\n');
253 } catch (e) { 250 } catch (e) {
254 // Double faults ignored. 251 // Double faults ignored.
255 } 252 }
256 rethrow; 253 rethrow;
257 } 254 }
258 } 255 }
259 256
260 void onSelectionChange(Event event) => state.onSelectionChange(event); 257 void onSelectionChange(Event event) => state.onSelectionChange(event);
261 258
262 void onCompilationUnitChanged(CompilationUnit unit) { 259 void onCompilationUnitChanged(CompilationUnit unit) {
(...skipping 22 matching lines...) Expand all
285 282
286 void consolePrintLine(line) => state.consolePrintLine(line); 283 void consolePrintLine(line) => state.consolePrintLine(line);
287 284
288 void aboutToRun() => state.aboutToRun(); 285 void aboutToRun() => state.aboutToRun();
289 286
290 void onIframeError(ErrorMessage message) => state.onIframeError(message); 287 void onIframeError(ErrorMessage message) => state.onIframeError(message);
291 288
292 void verboseCompilerMessage(String message) { 289 void verboseCompilerMessage(String message) {
293 return state.verboseCompilerMessage(message); 290 return state.verboseCompilerMessage(message);
294 } 291 }
292
293 void onCompilerCrash(data) => state.onCompilerCrash(data);
294
295 void onInternalError(message) => state.onInternalError(message);
295 } 296 }
296 297
297 abstract class InteractionState implements InteractionManager { 298 abstract class InteractionState implements InteractionManager {
298 InteractionContext get context; 299 InteractionContext get context;
299 300
300 // TODO(ahe): Remove this. 301 // TODO(ahe): Remove this.
301 Set<AnchorElement> get oldDiagnostics { 302 Set<AnchorElement> get oldDiagnostics {
302 throw 'Use context.oldDiagnostics instead'; 303 throw 'Use context.oldDiagnostics instead';
303 } 304 }
304 305
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 void verboseCompilerMessage(String message) { 737 void verboseCompilerMessage(String message) {
737 if (settings.verboseCompiler) { 738 if (settings.verboseCompiler) {
738 context.compilerConsole.appendText('$message\n'); 739 context.compilerConsole.appendText('$message\n');
739 } else { 740 } else {
740 if (isCompilerStageMarker(message)) { 741 if (isCompilerStageMarker(message)) {
741 Element progress = context.compilerConsole.firstChild; 742 Element progress = context.compilerConsole.firstChild;
742 progress.appendText('.'); 743 progress.appendText('.');
743 } 744 }
744 } 745 }
745 } 746 }
747
748 void onCompilerCrash(data) {
749 onInternalError('Error and stack trace:\n$data');
750 }
751
752 void onInternalError(message) {
753 outputDiv
754 ..nodes.clear()
755 ..append(new HeadingElement.h1()..appendText('Internal Error'))
756 ..appendText('We would appreciate if you take a moment to report '
757 'this at ')
758 ..append(
759 new AnchorElement(href: TRY_DART_NEW_DEFECT)
760 ..target = '_blank'
761 ..appendText(TRY_DART_NEW_DEFECT))
762 ..appendText('$message');
763 if (window.parent != window) {
764 // Test support.
765 // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version
766 // 30 across build bots. Support for '/' was added in version 29, and we
767 // support the two most recent versions.
768 window.parent.postMessage('$message\n', '*');
769 }
770 }
746 } 771 }
747 772
748 Future<String> getString(uri) { 773 Future<String> getString(uri) {
749 return new Future<String>.sync(() => HttpRequest.getString('$uri')); 774 return new Future<String>.sync(() => HttpRequest.getString('$uri'));
750 } 775 }
751 776
752 class PendingInputState extends InitialState { 777 class PendingInputState extends InitialState {
753 PendingInputState(InteractionContext context) 778 PendingInputState(InteractionContext context)
754 : super(context); 779 : super(context);
755 780
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 bool isCompilerStageMarker(String message) { 1221 bool isCompilerStageMarker(String message) {
1197 return 1222 return
1198 message.startsWith('Package root is ') || 1223 message.startsWith('Package root is ') ||
1199 message.startsWith('Compiling ') || 1224 message.startsWith('Compiling ') ||
1200 message == "Resolving..." || 1225 message == "Resolving..." ||
1201 message.startsWith('Resolved ') || 1226 message.startsWith('Resolved ') ||
1202 message == "Inferring types..." || 1227 message == "Inferring types..." ||
1203 message == "Compiling..." || 1228 message == "Compiling..." ||
1204 message.startsWith('Compiled '); 1229 message.startsWith('Compiled ');
1205 } 1230 }
OLDNEW
« no previous file with comments | « no previous file | dart/tests/try/end_to_end_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698