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

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

Issue 2287793002: Converted Observatory field-view element (Closed)
Patch Set: Fixed tests Created 4 years, 3 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/class_tree.dart'; 7 import 'package:observatory/src/elements/class_tree.dart';
8 import 'package:observatory/src/elements/nav/notify.dart'; 8 import 'package:observatory/src/elements/nav/notify.dart';
9 import '../mocks.dart'; 9 import '../mocks.dart';
10 10
(...skipping 21 matching lines...) Expand all
32 const child2 = const ClassMock(id: child2_id); 32 const child2 = const ClassMock(id: child2_id);
33 const child1_1 = const ClassMock(id: child1_1_id); 33 const child1_1 = const ClassMock(id: child1_1_id);
34 const child1 = const ClassMock(id: child1_id, 34 const child1 = const ClassMock(id: child1_id,
35 subclasses: const [child1_1]); 35 subclasses: const [child1_1]);
36 const object = const ClassMock(id: 'o-id', 36 const object = const ClassMock(id: 'o-id',
37 subclasses: const [child1, child2]); 37 subclasses: const [child1, child2]);
38 const ids = const [child1_id, child1_1_id, child2_id]; 38 const ids = const [child1_id, child1_1_id, child2_id];
39 bool rendered = false; 39 bool rendered = false;
40 final e = new ClassTreeElement(vm, isolate, events, notifications, 40 final e = new ClassTreeElement(vm, isolate, events, notifications,
41 new ClassRepositoryMock( 41 new ClassRepositoryMock(
42 object: expectAsync(() async { 42 object: expectAsync((i) async {
43 expect(i, equals(isolate));
43 expect(rendered, isFalse); 44 expect(rendered, isFalse);
44 return object; 45 return object;
45 }, count: 1), 46 }, count: 1),
46 getter: expectAsync((id) async { 47 getter: expectAsync((i, id) async {
48 expect(i, equals(isolate));
47 expect(ids.contains(id), isTrue); 49 expect(ids.contains(id), isTrue);
48 switch (id) { 50 switch (id) {
49 case child1_id: return child1; 51 case child1_id: return child1;
50 case child1_1_id: return child1_1; 52 case child1_1_id: return child1_1;
51 case child2_id: return child2; 53 case child2_id: return child2;
52 default: return null; 54 default: return null;
53 } 55 }
54 }, count: 3))); 56 }, count: 3)));
55 document.body.append(e); 57 document.body.append(e);
56 await e.onRendered.first; 58 await e.onRendered.first;
57 rendered = true; 59 rendered = true;
58 expect(e.children.length, isNonZero, reason: 'has elements'); 60 expect(e.children.length, isNonZero, reason: 'has elements');
59 expect(e.querySelectorAll(nTag).length, equals(1)); 61 expect(e.querySelectorAll(nTag).length, equals(1));
60 e.remove(); 62 e.remove();
61 await e.onRendered.first; 63 await e.onRendered.first;
62 expect(e.children.length, isZero, reason: 'is empty'); 64 expect(e.children.length, isZero, reason: 'is empty');
63 }); 65 });
64 }); 66 });
65 } 67 }
OLDNEW
« no previous file with comments | « runtime/observatory/observatory_sources.gypi ('k') | runtime/observatory/tests/observatory_ui/mocks/repositories/class.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698