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

Side by Side Diff: runtime/observatory/tests/observatory_ui/nav/notify/element_test.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (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 import 'dart:html' hide Notification, NotificationEvent; 5 import 'dart:html' hide Notification, NotificationEvent;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/models.dart' as M; 7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/src/elements/nav/notify.dart'; 8 import 'package:observatory/src/elements/nav/notify.dart';
9 import 'package:observatory/src/elements/nav/notify_event.dart'; 9 import 'package:observatory/src/elements/nav/notify_event.dart';
10 import 'package:observatory/src/elements/nav/notify_exception.dart'; 10 import 'package:observatory/src/elements/nav/notify_exception.dart';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 final e = new NavNotifyElement(repository); 45 final e = new NavNotifyElement(repository);
46 document.body.append(e); 46 document.body.append(e);
47 await e.onRendered.first; 47 await e.onRendered.first;
48 expect(repository.hasListeners, isTrue, reason: 'is listening'); 48 expect(repository.hasListeners, isTrue, reason: 'is listening');
49 e.remove(); 49 e.remove();
50 await e.onRendered.first; 50 await e.onRendered.first;
51 expect(repository.hasListeners, isFalse, reason: 'is no more listening'); 51 expect(repository.hasListeners, isFalse, reason: 'is no more listening');
52 }); 52 });
53 group('elements', () { 53 group('elements', () {
54 test('created after attachment', () async { 54 test('created after attachment', () async {
55 final repository = new NotificationRepositoryMock(list: [ 55 final repository =
56 new ExceptionNotificationMock(exception: new Exception("ex")), 56 new NotificationRepositoryMock(list: [
57 const EventNotificationMock(event: const VMUpdateEventMock(vm: vm)), 57 new ExceptionNotificationMock(exception: new Exception("ex")),
58 const EventNotificationMock(event: const VMUpdateEventMock(vm: vm)) 58 const EventNotificationMock(event: const VMUpdateEventMock(vm: vm)),
59 ]); 59 const EventNotificationMock(event: const VMUpdateEventMock(vm: vm))
60 ]);
60 final e = new NavNotifyElement(repository); 61 final e = new NavNotifyElement(repository);
61 document.body.append(e); 62 document.body.append(e);
62 await e.onRendered.first; 63 await e.onRendered.first;
63 expect(repository.listInvoked, isTrue, reason: 'should invoke list()'); 64 expect(repository.listInvoked, isTrue, reason: 'should invoke list()');
64 expect(e.children.length, isNonZero, reason: 'has elements'); 65 expect(e.children.length, isNonZero, reason: 'has elements');
65 expect(e.querySelectorAll(evTag).length, equals(2)); 66 expect(e.querySelectorAll(evTag).length, equals(2));
66 expect(e.querySelectorAll(exTag).length, equals(1)); 67 expect(e.querySelectorAll(exTag).length, equals(1));
67 e.remove(); 68 e.remove();
68 await e.onRendered.first; 69 await e.onRendered.first;
69 expect(e.children.length, isZero, reason: 'is empty'); 70 expect(e.children.length, isZero, reason: 'is empty');
70 }); 71 });
71 test('react to notifyOnPause change', () async { 72 test('react to notifyOnPause change', () async {
72 final NotificationRepositoryMock repository = 73 final NotificationRepositoryMock repository =
73 new NotificationRepositoryMock(list: [ 74 new NotificationRepositoryMock(list: [
74 new ExceptionNotificationMock(exception: new Exception("ex")), 75 new ExceptionNotificationMock(exception: new Exception("ex")),
75 const EventNotificationMock(event: const VMUpdateEventMock()), 76 const EventNotificationMock(event: const VMUpdateEventMock()),
76 const EventNotificationMock( 77 const EventNotificationMock(
77 event: const PauseStartEventMock(isolate: isolate)) 78 event: const PauseStartEventMock(isolate: isolate))
78 ]); 79 ]);
79 final e = new NavNotifyElement(repository, notifyOnPause: true); 80 final e = new NavNotifyElement(repository, notifyOnPause: true);
80 document.body.append(e); 81 document.body.append(e);
81 await e.onRendered.first; 82 await e.onRendered.first;
82 expect(e.querySelectorAll(evTag).length, equals(2)); 83 expect(e.querySelectorAll(evTag).length, equals(2));
83 expect(e.querySelectorAll(exTag).length, equals(1)); 84 expect(e.querySelectorAll(exTag).length, equals(1));
84 e.notifyOnPause = false; 85 e.notifyOnPause = false;
85 await e.onRendered.first; 86 await e.onRendered.first;
86 expect(e.querySelectorAll(evTag).length, equals(1)); 87 expect(e.querySelectorAll(evTag).length, equals(1));
87 expect(e.querySelectorAll(exTag).length, equals(1)); 88 expect(e.querySelectorAll(exTag).length, equals(1));
88 e.notifyOnPause = true; 89 e.notifyOnPause = true;
(...skipping 20 matching lines...) Expand all
109 repository.triggerChangeEvent(); 110 repository.triggerChangeEvent();
110 await e.onRendered.first; 111 await e.onRendered.first;
111 expect(e.querySelectorAll(evTag).length, equals(2)); 112 expect(e.querySelectorAll(evTag).length, equals(2));
112 expect(e.querySelectorAll(exTag).length, equals(1)); 113 expect(e.querySelectorAll(exTag).length, equals(1));
113 e.remove(); 114 e.remove();
114 await e.onRendered.first; 115 await e.onRendered.first;
115 expect(e.children.length, isZero, reason: 'is empty'); 116 expect(e.children.length, isZero, reason: 'is empty');
116 }); 117 });
117 }); 118 });
118 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698