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

Unified Diff: tests/lib_strong/html/html_mock_test.dart

Issue 2949123002: Fix mocked operator methods (Closed)
Patch Set: Created 3 years, 6 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: tests/lib_strong/html/html_mock_test.dart
diff --git a/tests/lib_strong/html/html_mock_test.dart b/tests/lib_strong/html/html_mock_test.dart
index b470495181cb5079587208341a119f84cc34f7d6..1d4aeb9e5e1ee9287dafa82f45ed371caf9515e7 100644
--- a/tests/lib_strong/html/html_mock_test.dart
+++ b/tests/lib_strong/html/html_mock_test.dart
@@ -8,7 +8,11 @@ import 'dart:html';
import 'package:expect/minitest.dart';
class Mock {
- noSuchMethod(Invocation i) => document;
+ noSuchMethod(Invocation i) {
+ if (this is Window) return document;
+ if (this is FileList) return new MockFile();
+ return null;
+ }
}
@proxy
@@ -39,6 +43,12 @@ class MockLocation extends Mock implements Location {
String href = "MOCK_HREF";
}
+@proxy
+class MockFileList extends Mock implements FileList {}
+
+@proxy
+class MockFile extends Mock implements File {}
+
main() {
test('is', () {
var win = new MockWindow();
@@ -78,4 +88,9 @@ main() {
HtmlDocument doc = new MockHtmlDocument();
expect(doc.onBlur is Stream, isTrue, reason: 'onBlur should be a stream');
});
+
+ test('operator', () {
+ var fileList = new MockFileList();
+ expect(fileList[1] is File, isTrue);
+ });
}

Powered by Google App Engine
This is Rietveld 408576698