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

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

Issue 2873013004: Omnibus Observatory UI fixes: (Closed)
Patch Set: Created 3 years, 7 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'; 5 import 'dart:html';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/src/elements/ports.dart'; 7 import 'package:observatory/src/elements/ports.dart';
8 import '../mocks.dart'; 8 import '../mocks.dart';
9 9
10 main() { 10 main() {
11 PortsElement.tag.ensureRegistration(); 11 PortsElement.tag.ensureRegistration();
12 12
13 const vm = const VMMock(); 13 const vm = const VMMock();
14 const isolate = const IsolateRefMock(); 14 const isolate = const IsolateRefMock();
15 final events = new EventRepositoryMock(); 15 final events = new EventRepositoryMock();
16 final notifs = new NotificationRepositoryMock(); 16 final notifs = new NotificationRepositoryMock();
17 final ports = new PortsRepositoryMock(); 17 final ports = new PortsRepositoryMock();
18 final instances = new InstanceRepositoryMock(); 18 final objects = new ObjectRepositoryMock();
19 test('instantiation', () { 19 test('instantiation', () {
20 final e = new PortsElement(vm, isolate, events, notifs, ports, instances); 20 final e = new PortsElement(vm, isolate, events, notifs, ports, objects);
21 expect(e, isNotNull, reason: 'element correctly created'); 21 expect(e, isNotNull, reason: 'element correctly created');
22 expect(e.isolate, equals(isolate)); 22 expect(e.isolate, equals(isolate));
23 expect(e.ports, equals(ports)); 23 expect(e.ports, equals(ports));
24 }); 24 });
25 test('elements created after attachment', () async { 25 test('elements created after attachment', () async {
26 const elements = const [ 26 const elements = const [
27 const PortMock(name: 'port-1'), 27 const PortMock(name: 'port-1'),
28 const PortMock(name: 'port-2'), 28 const PortMock(name: 'port-2'),
29 const PortMock(name: 'port-3') 29 const PortMock(name: 'port-3')
30 ]; 30 ];
31 const isolatePorts = const PortsMock(elements: elements); 31 const isolatePorts = const PortsMock(elements: elements);
32 final ports = new PortsRepositoryMock( 32 final ports = new PortsRepositoryMock(
33 getter: expectAsync((i) async { 33 getter: expectAsync((i) async {
34 expect(i, equals(isolate)); 34 expect(i, equals(isolate));
35 return isolatePorts; 35 return isolatePorts;
36 }, count: 1)); 36 }, count: 1));
37 final instances = new InstanceRepositoryMock(); 37 final objects = new ObjectRepositoryMock();
38 final e = new PortsElement(vm, isolate, events, notifs, ports, instances); 38 final e = new PortsElement(vm, isolate, events, notifs, ports, objects);
39 document.body.append(e); 39 document.body.append(e);
40 await e.onRendered.first; 40 await e.onRendered.first;
41 expect(e.children.length, isNonZero, reason: 'has elements'); 41 expect(e.children.length, isNonZero, reason: 'has elements');
42 expect(e.querySelectorAll('.port-number').length, equals(elements.length)); 42 expect(e.querySelectorAll('.port-number').length, equals(elements.length));
43 e.remove(); 43 e.remove();
44 await e.onRendered.first; 44 await e.onRendered.first;
45 expect(e.children.length, isZero, reason: 'is empty'); 45 expect(e.children.length, isZero, reason: 'is empty');
46 }); 46 });
47 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698