| OLD | NEW |
| 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.internal_error_test; | 5 library trydart.internal_error_test; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:try/src/interaction_manager.dart' show | 10 import 'package:try/src/interaction_manager.dart' show |
| 11 InteractionManager, | 11 InteractionManager, |
| 12 TRY_DART_NEW_DEFECT; | 12 TRY_DART_NEW_DEFECT; |
| 13 | 13 |
| 14 import 'package:try/src/ui.dart' show | 14 import 'package:try/src/ui.dart' show |
| 15 mainEditorPane, | 15 mainEditorPane, |
| 16 observer, | 16 observer, |
| 17 outputDiv; | 17 outputDiv; |
| 18 | 18 |
| 19 import 'package:try/src/user_option.dart' show | 19 import 'package:try/src/user_option.dart' show |
| 20 UserOption; | 20 UserOption; |
| 21 | 21 |
| 22 import '../../pkg/expect/lib/expect.dart'; | 22 import 'package:expect/expect.dart'; |
| 23 import '../../pkg/async_helper/lib/async_helper.dart'; | 23 import 'package:async_helper/async_helper.dart'; |
| 24 | 24 |
| 25 main() { | 25 main() { |
| 26 UserOption.storage = {}; | 26 UserOption.storage = {}; |
| 27 | 27 |
| 28 var interaction = new InteractionManager(); | 28 var interaction = new InteractionManager(); |
| 29 mainEditorPane = new DivElement(); | 29 mainEditorPane = new DivElement(); |
| 30 outputDiv = new PreElement(); | 30 outputDiv = new PreElement(); |
| 31 document.body.append(mainEditorPane); | 31 document.body.append(mainEditorPane); |
| 32 observer = new MutationObserver((mutations, observer) { | 32 observer = new MutationObserver((mutations, observer) { |
| 33 try { | 33 try { |
| 34 interaction.onMutation(mutations, observer); | 34 interaction.onMutation(mutations, observer); |
| 35 } catch (e) { | 35 } catch (e) { |
| 36 // Ignored. | 36 // Ignored. |
| 37 } | 37 } |
| 38 }); | 38 }); |
| 39 observer.observe( | 39 observer.observe( |
| 40 mainEditorPane, childList: true, characterData: true, subtree: true); | 40 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 41 | 41 |
| 42 mainEditorPane.innerHtml = 'main() { print("hello"); }'; | 42 mainEditorPane.innerHtml = 'main() { print("hello"); }'; |
| 43 | 43 |
| 44 interaction.currentCompilationUnit = null; // This will provoke a crash. | 44 interaction.currentCompilationUnit = null; // This will provoke a crash. |
| 45 | 45 |
| 46 asyncTest(() { | 46 asyncTest(() { |
| 47 return new Future(() { | 47 return new Future(() { |
| 48 Expect.isTrue(outputDiv.text.contains(TRY_DART_NEW_DEFECT)); | 48 Expect.isTrue(outputDiv.text.contains(TRY_DART_NEW_DEFECT)); |
| 49 }); | 49 }); |
| 50 }); | 50 }); |
| 51 } | 51 } |
| OLD | NEW |