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

Unified Diff: dart/tests/try/mock_try.dart

Issue 269343009: Add (failing) source_update_test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/tests/try/cursor_position_test.dart ('k') | dart/tests/try/source_update_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/try/mock_try.dart
diff --git a/dart/tests/try/mock_try.dart b/dart/tests/try/mock_try.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1e2e3e500fb39dd9c7dc2e59fa3bc68040145d17
--- /dev/null
+++ b/dart/tests/try/mock_try.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html' show
+ DivElement,
+ MutationObserver,
+ document;
+
+import '../../site/try/src/interaction_manager.dart' show
+ InteractionManager;
+
+import '../../site/try/src/ui.dart' show
+ hackDiv,
+ mainEditorPane,
+ observer;
+
+import '../../site/try/src/user_option.dart' show
+ UserOption;
+
+InteractionManager mockTryDartInteraction() {
+ UserOption.storage = {};
+
+ InteractionManager interaction = new InteractionManager();
+
+ hackDiv = new DivElement();
+ mainEditorPane = new DivElement()
+ ..style.whiteSpace = 'pre'
+ ..contentEditable = 'true';
+
+ observer = new MutationObserver(interaction.onMutation);
+ observer.observe(
+ mainEditorPane, childList: true, characterData: true, subtree: true);
+
+ document.body.nodes.addAll([mainEditorPane, hackDiv]);
+
+ return interaction;
+}
+
+void clearEditorPaneWithoutNotifications() {
+ mainEditorPane.nodes.clear();
+ observer.takeRecords();
+}
« no previous file with comments | « dart/tests/try/cursor_position_test.dart ('k') | dart/tests/try/source_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698