OLD | NEW |
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/nav/refresh.dart'; | 7 import 'package:observatory/src/elements/nav/refresh.dart'; |
8 import 'package:observatory/src/elements/object_common.dart'; | 8 import 'package:observatory/src/elements/object_common.dart'; |
9 import 'package:observatory/src/elements/objectpool_view.dart'; | 9 import 'package:observatory/src/elements/objectpool_view.dart'; |
10 import '../mocks.dart'; | 10 import '../mocks.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 final notifs = new NotificationRepositoryMock(); | 21 final notifs = new NotificationRepositoryMock(); |
22 final pool = const ObjectPoolMock(); | 22 final pool = const ObjectPoolMock(); |
23 final pools = new ObjectPoolRepositoryMock(); | 23 final pools = new ObjectPoolRepositoryMock(); |
24 final reachableSizes = new ReachableSizeRepositoryMock(); | 24 final reachableSizes = new ReachableSizeRepositoryMock(); |
25 final retainedSizes = new RetainedSizeRepositoryMock(); | 25 final retainedSizes = new RetainedSizeRepositoryMock(); |
26 final inbounds = new InboundReferencesRepositoryMock(); | 26 final inbounds = new InboundReferencesRepositoryMock(); |
27 final paths = new RetainingPathRepositoryMock(); | 27 final paths = new RetainingPathRepositoryMock(); |
28 final instances = new InstanceRepositoryMock(); | 28 final instances = new InstanceRepositoryMock(); |
29 test('instantiation', () { | 29 test('instantiation', () { |
30 final e = new ObjectPoolViewElement(vm, isolate, pool, events, notifs, | 30 final e = new ObjectPoolViewElement(vm, isolate, pool, events, notifs, |
31 pools, retainedSizes, reachableSizes, | 31 pools, retainedSizes, reachableSizes, inbounds, paths, instances); |
32 inbounds, paths, instances); | |
33 expect(e, isNotNull, reason: 'element correctly created'); | 32 expect(e, isNotNull, reason: 'element correctly created'); |
34 expect(e.isolate, equals(isolate)); | 33 expect(e.isolate, equals(isolate)); |
35 expect(e.pool, equals(pool)); | 34 expect(e.pool, equals(pool)); |
36 }); | 35 }); |
37 test('elements created after attachment', () async { | 36 test('elements created after attachment', () async { |
38 final pools = new ObjectPoolRepositoryMock( | 37 final pools = new ObjectPoolRepositoryMock( |
39 getter: expectAsync((i, id) async { | 38 getter: expectAsync((i, id) async { |
40 expect(i, equals(isolate)); | 39 expect(i, equals(isolate)); |
41 expect(id, equals(pool.id)); | 40 expect(id, equals(pool.id)); |
42 return pool; | 41 return pool; |
43 }, count: 1) | 42 }, count: 1)); |
44 ); | |
45 final e = new ObjectPoolViewElement(vm, isolate, pool, events, notifs, | 43 final e = new ObjectPoolViewElement(vm, isolate, pool, events, notifs, |
46 pools, retainedSizes, reachableSizes, | 44 pools, retainedSizes, reachableSizes, inbounds, paths, instances); |
47 inbounds, paths, instances); | |
48 document.body.append(e); | 45 document.body.append(e); |
49 await e.onRendered.first; | 46 await e.onRendered.first; |
50 expect(e.children.length, isNonZero, reason: 'has elements'); | 47 expect(e.children.length, isNonZero, reason: 'has elements'); |
51 expect(e.querySelectorAll(cTag).length, equals(1)); | 48 expect(e.querySelectorAll(cTag).length, equals(1)); |
52 (e.querySelector(rTag) as NavRefreshElement).refresh(); | 49 (e.querySelector(rTag) as NavRefreshElement).refresh(); |
53 await e.onRendered.first; | 50 await e.onRendered.first; |
54 e.remove(); | 51 e.remove(); |
55 await e.onRendered.first; | 52 await e.onRendered.first; |
56 expect(e.children.length, isZero, reason: 'is empty'); | 53 expect(e.children.length, isZero, reason: 'is empty'); |
57 }); | 54 }); |
58 } | 55 } |
OLD | NEW |