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

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

Issue 2803673007: fix #29233, final fields can be settable in a mock (Closed)
Patch Set: fix Created 3 years, 8 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 bdf88600e4cf9b80978e022bba80a78b63da8649..b470495181cb5079587208341a119f84cc34f7d6 100644
--- a/tests/lib_strong/html/html_mock_test.dart
+++ b/tests/lib_strong/html/html_mock_test.dart
@@ -16,13 +16,19 @@ class MockBodyElement extends Mock implements BodyElement {
Node append(Node e) => e;
}
+class _EventListeners {
+ Stream<Event> get onBlur => new Stream.fromIterable([]);
+}
+
@proxy
-class MockHtmlDocument extends Mock implements HtmlDocument {
+class MockHtmlDocument extends Mock
+ with _EventListeners
+ implements HtmlDocument {
BodyElement get body => new MockBodyElement();
}
@proxy
-class MockWindow extends Mock implements Window {
+class MockWindow extends Mock with _EventListeners implements Window {
Stream<Event> get onBeforeUnload => new Stream.fromIterable([]);
String name = "MOCK_NAME";
@@ -65,4 +71,11 @@ main() {
HtmlDocument doc = new MockHtmlDocument();
expect(doc.body.append(null), equals(null));
});
+
+ test('mixin', () {
+ Window win = new MockWindow();
+ expect(win.onBlur is Stream, isTrue, reason: 'onBlur should be a stream');
+ HtmlDocument doc = new MockHtmlDocument();
+ expect(doc.onBlur is Stream, isTrue, reason: 'onBlur should be a stream');
+ });
}

Powered by Google App Engine
This is Rietveld 408576698