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

Side by Side Diff: runtime/observatory/tests/observatory_ui/mocks/repositories/notification.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of mocks; 5 part of mocks;
6 6
7 class NotificationChangeEventMock implements M.NotificationChangeEvent { 7 class NotificationChangeEventMock implements M.NotificationChangeEvent {
8 final NotificationRepositoryMock repository; 8 final NotificationRepositoryMock repository;
9 const NotificationChangeEventMock({this.repository}); 9 const NotificationChangeEventMock({this.repository});
10 } 10 }
11 11
12 typedef void NotificationRepositoryMockCallback(M.Notification notification); 12 typedef void NotificationRepositoryMockCallback(M.Notification notification);
13 13
14 class NotificationRepositoryMock implements M.NotificationRepository { 14 class NotificationRepositoryMock implements M.NotificationRepository {
15 final StreamController<M.NotificationChangeEvent> _onChange = 15 final StreamController<M.NotificationChangeEvent> _onChange =
16 new StreamController<M.NotificationChangeEvent>.broadcast(); 16 new StreamController<M.NotificationChangeEvent>.broadcast();
17 Stream<M.NotificationChangeEvent> get onChange => _onChange.stream; 17 Stream<M.NotificationChangeEvent> get onChange => _onChange.stream;
18 18
19 bool get hasListeners => _onChange.hasListener; 19 bool get hasListeners => _onChange.hasListener;
20 20
21 final Iterable<M.Notification> _list; 21 final Iterable<M.Notification> _list;
22 final NotificationRepositoryMockCallback _add; 22 final NotificationRepositoryMockCallback _add;
23 final NotificationRepositoryMockCallback _delete; 23 final NotificationRepositoryMockCallback _delete;
24 24
25 bool addInvoked = false; 25 bool addInvoked = false;
26 bool listInvoked = false; 26 bool listInvoked = false;
27 bool deleteInvoked = false; 27 bool deleteInvoked = false;
28 bool deleteAllInvoked = false; 28 bool deleteAllInvoked = false;
29 29
30
31 void add(M.Notification notification) { 30 void add(M.Notification notification) {
32 addInvoked = true; 31 addInvoked = true;
33 if (_add != null) _add(notification); 32 if (_add != null) _add(notification);
34 } 33 }
35 34
36 Iterable<M.Notification> list() { 35 Iterable<M.Notification> list() {
37 listInvoked = true; 36 listInvoked = true;
38 return _list; 37 return _list;
39 } 38 }
40 39
41 void delete(M.Notification notification) { 40 void delete(M.Notification notification) {
42 deleteInvoked = true; 41 deleteInvoked = true;
43 if (_add != null) _delete(notification); 42 if (_add != null) _delete(notification);
44 } 43 }
45 44
46 void deleteAll() { deleteAllInvoked = true; } 45 void deleteAll() {
46 deleteAllInvoked = true;
47 }
47 48
48 void triggerChangeEvent() { 49 void triggerChangeEvent() {
49 _onChange.add(new NotificationChangeEventMock(repository: this)); 50 _onChange.add(new NotificationChangeEventMock(repository: this));
50 } 51 }
51 52
52 NotificationRepositoryMock({Iterable<M.Notification> list : const [], 53 NotificationRepositoryMock(
54 {Iterable<M.Notification> list: const [],
53 NotificationRepositoryMockCallback add, 55 NotificationRepositoryMockCallback add,
54 NotificationRepositoryMockCallback delete}) 56 NotificationRepositoryMockCallback delete})
55 : _list = list, 57 : _list = list,
56 _add = add, 58 _add = add,
57 _delete = delete; 59 _delete = delete;
58 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698