Fix swarm sample.

This started breaking with some stricter override checks added in 48a258a4a5

Change-Id: I8c1ca90e1edfe7866949e0493db6bc7cc0063e9d
Reviewed-on: https://dart-review.googlesource.com/65783
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2018-07-19 20:16:47 +00:00 committed by commit-bot@chromium.org
parent bbcd237d08
commit 6f5b0b5ddc
2 changed files with 39 additions and 7 deletions

View file

@ -239,14 +239,40 @@ class MockTouch implements Touch {
}
}
class MockTouchList extends Object
with ListMixin<Touch>, ImmutableListMixin<Touch>
implements TouchList {
final List<Touch> values;
MockTouchList(this.values);
static bool get supported => true;
int get length => values.length;
Touch operator [](int index) => values[index];
void operator []=(int index, Touch value) {
throw new UnsupportedError("Cannot assign element of immutable List.");
}
set length(int value) {
throw new UnsupportedError("Cannot resize immutable List.");
}
Touch item(int index) => values[index];
}
class MockTouchEvent implements TouchEvent {
dynamic /*MouseEvent*/ wrapped;
// TODO(jacobr): these are currently Lists instead of a TouchList.
final List<Touch> touches;
final List<Touch> targetTouches;
final List<Touch> changedTouches;
MockTouchEvent(MouseEvent this.wrapped, List<Touch> this.touches,
List<Touch> this.targetTouches, List<Touch> this.changedTouches) {}
final TouchList touches;
final TouchList targetTouches;
final TouchList changedTouches;
MockTouchEvent(MouseEvent this.wrapped, List<Touch> touches,
List<Touch> targetTouches, List<Touch> changedTouches)
: touches = new MockTouchList(touches),
targetTouches = new MockTouchList(targetTouches),
changedTouches = new MockTouchList(changedTouches);
bool get bubbles => wrapped.bubbles;

View file

@ -5,7 +5,13 @@
library touch;
import 'dart:async';
import 'dart:collection' show Queue, DoubleLinkedQueue, DoubleLinkedQueueEntry;
import 'dart:collection'
show
Queue,
DoubleLinkedQueue,
DoubleLinkedQueueEntry,
ListMixin,
ImmutableListMixin;
import 'dart:html';
import 'dart:math' as Math;