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

Side by Side Diff: runtime/observatory/tests/observatory_ui/heap_snapshot/element_test.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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:observatory/models.dart' as M; 8 import 'package:observatory/models.dart' as M;
9 import 'package:observatory/src/elements/containers/virtual_tree.dart'; 9 import 'package:observatory/src/elements/containers/virtual_tree.dart';
10 import 'package:observatory/src/elements/heap_snapshot.dart'; 10 import 'package:observatory/src/elements/heap_snapshot.dart';
11 import '../mocks.dart'; 11 import '../mocks.dart';
12 12
13 main() { 13 main() {
14 HeapSnapshotElement.tag.ensureRegistration(); 14 HeapSnapshotElement.tag.ensureRegistration();
15 15
16 final tTag = VirtualTreeElement.tag.name; 16 final tTag = VirtualTreeElement.tag.name;
17 17
18 const vm = const VMMock(); 18 const vm = const VMMock();
19 const isolate = const IsolateRefMock(); 19 const isolate = const IsolateRefMock();
20 final events = new EventRepositoryMock(); 20 final events = new EventRepositoryMock();
21 final notifs = new NotificationRepositoryMock(); 21 final notifs = new NotificationRepositoryMock();
22 final snapshots = new HeapSnapshotRepositoryMock(); 22 final snapshots = new HeapSnapshotRepositoryMock();
23 final instances = new InstanceRepositoryMock(); 23 final instances = new InstanceRepositoryMock();
24 test('instantiation', () { 24 test('instantiation', () {
25 final e = new HeapSnapshotElement(vm, isolate, events, notifs, snapshots, 25 final e = new HeapSnapshotElement(
26 instances); 26 vm, isolate, events, notifs, snapshots, instances);
27 expect(e, isNotNull, reason: 'element correctly created'); 27 expect(e, isNotNull, reason: 'element correctly created');
28 }); 28 });
29 test('elements created', () async { 29 test('elements created', () async {
30 final controller 30 final controller =
31 = new StreamController<M.HeapSnapshotLoadingProgressEvent>.broadcast(); 31 new StreamController<M.HeapSnapshotLoadingProgressEvent>.broadcast();
32 final snapshots = new HeapSnapshotRepositoryMock( 32 final snapshots =
33 getter: (M.IsolateRef i, bool gc) { 33 new HeapSnapshotRepositoryMock(getter: (M.IsolateRef i, bool gc) {
34 expect(i, equals(isolate)); 34 expect(i, equals(isolate));
35 expect(gc, isFalse); 35 expect(gc, isFalse);
36 return controller.stream; 36 return controller.stream;
37 } 37 });
38 ); 38 final e = new HeapSnapshotElement(
39 final e = new HeapSnapshotElement(vm, isolate, events, notifs, snapshots, 39 vm, isolate, events, notifs, snapshots, instances);
40 instances);
41 document.body.append(e); 40 document.body.append(e);
42 await e.onRendered.first; 41 await e.onRendered.first;
43 expect(e.children.length, isNonZero, reason: 'has elements'); 42 expect(e.children.length, isNonZero, reason: 'has elements');
44 expect(e.querySelectorAll(tTag).length, isZero); 43 expect(e.querySelectorAll(tTag).length, isZero);
45 controller.add(const HeapSnapshotLoadingProgressEventMock( 44 controller.add(const HeapSnapshotLoadingProgressEventMock(
46 progress: const HeapSnapshotLoadingProgressMock( 45 progress: const HeapSnapshotLoadingProgressMock(
47 status: M.HeapSnapshotLoadingStatus.fetching 46 status: M.HeapSnapshotLoadingStatus.fetching)));
48 )
49 ));
50 await e.onRendered.first; 47 await e.onRendered.first;
51 expect(e.querySelectorAll(tTag).length, isZero); 48 expect(e.querySelectorAll(tTag).length, isZero);
52 controller.add(const HeapSnapshotLoadingProgressEventMock( 49 controller.add(const HeapSnapshotLoadingProgressEventMock(
53 progress: const HeapSnapshotLoadingProgressMock( 50 progress: const HeapSnapshotLoadingProgressMock(
54 status: M.HeapSnapshotLoadingStatus.loading 51 status: M.HeapSnapshotLoadingStatus.loading)));
55 )
56 ));
57 controller.add(new HeapSnapshotLoadingProgressEventMock( 52 controller.add(new HeapSnapshotLoadingProgressEventMock(
58 progress: new HeapSnapshotLoadingProgressMock( 53 progress: new HeapSnapshotLoadingProgressMock(
59 status: M.HeapSnapshotLoadingStatus.loaded, 54 status: M.HeapSnapshotLoadingStatus.loaded,
60 snapshot: new HeapSnapshotMock(timestamp: new DateTime.now()) 55 snapshot: new HeapSnapshotMock(timestamp: new DateTime.now()))));
61 )
62 ));
63 controller.close(); 56 controller.close();
64 await e.onRendered.first; 57 await e.onRendered.first;
65 expect(e.querySelectorAll(tTag).length, equals(1)); 58 expect(e.querySelectorAll(tTag).length, equals(1));
66 e.remove(); 59 e.remove();
67 await e.onRendered.first; 60 await e.onRendered.first;
68 expect(e.children.length, isZero, reason: 'is empty'); 61 expect(e.children.length, isZero, reason: 'is empty');
69 }); 62 });
70 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698