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: runtime/observatory/lib/src/mocks/repositories/target.dart

Issue 2211603002: Centralized event streams (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master Created 4 years, 4 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: runtime/observatory/lib/src/mocks/repositories/target.dart
diff --git a/runtime/observatory/lib/src/mocks/repositories/target.dart b/runtime/observatory/lib/src/mocks/repositories/target.dart
deleted file mode 100644
index 8321f8612e7333a2ca177378c2bea58ae94190f0..0000000000000000000000000000000000000000
--- a/runtime/observatory/lib/src/mocks/repositories/target.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2016, 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
-
-part of mocks;
-
-class TargetChangeEventMock implements M.TargetChangeEvent {
- final TargetRepositoryMock repository;
- const TargetChangeEventMock({this.repository});
-}
-
-typedef void TargetRepositoryMockStringCallback(String notification);
-typedef void TargetRepositoryMockTargetCallback(M.Target notification);
-
-class TargetRepositoryMock implements M.TargetRepository {
- final StreamController<M.TargetChangeEvent> _onChange =
- new StreamController<M.TargetChangeEvent>.broadcast();
- Stream<M.TargetChangeEvent> get onChange => _onChange.stream;
-
- bool get hasListeners => _onChange.hasListener;
-
- final M.Target _current;
- final Iterable<M.Target> _list;
- final TargetRepositoryMockStringCallback _add;
- final TargetRepositoryMockTargetCallback _setCurrent;
- final TargetRepositoryMockTargetCallback _delete;
-
- bool currentInvoked = false;
- bool addInvoked = false;
- bool listInvoked = false;
- bool setCurrentInvoked = false;
- bool deleteInvoked = false;
-
- M.Target get current {
- currentInvoked = true;
- return _current;
- }
-
- void add(String val) {
- addInvoked = true;
- if (_add != null) _add(val);
- }
-
- Iterable<M.Target> list() {
- listInvoked = true;
- return _list;
- }
-
- void setCurrent(M.Target target) {
- setCurrentInvoked = true;
- if (_setCurrent != null) _setCurrent(target);
- }
-
- void delete(M.Target target) {
- deleteInvoked = true;
- if (_delete != null) _delete(target);
- }
-
- void triggerChangeEvent() {
- _onChange.add(new TargetChangeEventMock(repository: this));
- }
-
- TargetRepositoryMock({M.Target current, Iterable<M.Target> list : const [],
- TargetRepositoryMockStringCallback add,
- TargetRepositoryMockTargetCallback setCurrent,
- TargetRepositoryMockTargetCallback delete})
- : _current = current,
- _list = list,
- _add = add,
- _setCurrent = setCurrent,
- _delete = delete;
-}
« no previous file with comments | « runtime/observatory/lib/src/mocks/repositories/script.dart ('k') | runtime/observatory/lib/src/models/exceptions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698