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

Unified Diff: third_party/pkg/route_hierarchical/test/mocks.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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
Index: third_party/pkg/route_hierarchical/test/mocks.dart
diff --git a/third_party/pkg/route_hierarchical/test/mocks.dart b/third_party/pkg/route_hierarchical/test/mocks.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5465e4a10ca55f5dac9f9867cfd3794bed9562c5
--- /dev/null
+++ b/third_party/pkg/route_hierarchical/test/mocks.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, 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.
+
+library test_mocks;
+
+import 'dart:html';
+import 'package:unittest/mock.dart';
+
+class MockWindow extends Mock implements Window {
+ MockHistory history = new MockHistory();
+ MockLocation location = new MockLocation();
+ MockDocument document = new MockDocument();
+}
+
+class MockHistory extends Mock implements History {
+ //TODO(pavelgj): ugly hack for making tests run in dart2js
+ void pushState(Object data, String title, [String url]) {
+ log.add(new LogEntry(name, 'pushState', [data, title, url], Action.IGNORE));
+ }
+
+ //TODO(pavelgj): ugly hack for making tests run in dart2js
+ void replaceState(Object data, String title, [String url]) {
+ log.add(new LogEntry(name, 'replaceState', [data, title, url], Action.IGNORE));
+ }
+}
+
+class MockLocation extends Mock implements Location {}
+
+class MockDocument extends Mock implements HtmlDocument {
+ //TODO(pavelgj): ugly hack for making tests run in dart2js
+ String set title(title) =>
+ log.add(new LogEntry(name, '=title', [title], Action.IGNORE));
+}

Powered by Google App Engine
This is Rietveld 408576698