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

Side by Side Diff: runtime/observatory/tests/observatory_ui/megamorphiccache_view/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'; 5 import 'dart:html';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/src/elements/megamorphiccache_view.dart'; 7 import 'package:observatory/src/elements/megamorphiccache_view.dart';
8 import 'package:observatory/src/elements/nav/refresh.dart'; 8 import 'package:observatory/src/elements/nav/refresh.dart';
9 import 'package:observatory/src/elements/object_common.dart'; 9 import 'package:observatory/src/elements/object_common.dart';
10 import '../mocks.dart'; 10 import '../mocks.dart';
11 11
12 main() { 12 main() {
13 MegamorphicCacheViewElement.tag.ensureRegistration(); 13 MegamorphicCacheViewElement.tag.ensureRegistration();
14 14
15 final cTag = ObjectCommonElement.tag.name; 15 final cTag = ObjectCommonElement.tag.name;
16 final rTag = NavRefreshElement.tag.name; 16 final rTag = NavRefreshElement.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 cache = const MegamorphicCacheMock(); 22 final cache = const MegamorphicCacheMock();
23 final caches = new MegamorphicCacheRepositoryMock(); 23 final caches = new MegamorphicCacheRepositoryMock();
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 MegamorphicCacheViewElement( 30 final e = new MegamorphicCacheViewElement(vm, isolate, cache, events,
31 vm, 31 notifs, caches, retainedSizes,
32 isolate, 32 reachableSizes, inbounds, paths,
33 cache, 33 instances);
34 events,
35 notifs,
36 caches,
37 retainedSizes,
38 reachableSizes,
39 inbounds,
40 paths,
41 instances);
42 expect(e, isNotNull, reason: 'element correctly created'); 34 expect(e, isNotNull, reason: 'element correctly created');
43 expect(e.isolate, equals(isolate)); 35 expect(e.isolate, equals(isolate));
44 expect(e.cache, equals(cache)); 36 expect(e.cache, equals(cache));
45 }); 37 });
46 test('elements created after attachment', () async { 38 test('elements created after attachment', () async {
47 final caches = new MegamorphicCacheRepositoryMock( 39 final caches = new MegamorphicCacheRepositoryMock(
48 getter: expectAsync((i, id) async { 40 getter: expectAsync((i, id) async {
49 expect(i, equals(isolate)); 41 expect(i, equals(isolate));
50 expect(id, equals(cache.id)); 42 expect(id, equals(cache.id));
51 return cache; 43 return cache;
52 }, count: 1)); 44 }, count: 1)
53 final e = new MegamorphicCacheViewElement( 45 );
54 vm, 46 final e = new MegamorphicCacheViewElement(vm, isolate, cache, events,
55 isolate, 47 notifs, caches, retainedSizes,
56 cache, 48 reachableSizes, inbounds, paths,
57 events, 49 instances);
58 notifs,
59 caches,
60 retainedSizes,
61 reachableSizes,
62 inbounds,
63 paths,
64 instances);
65 document.body.append(e); 50 document.body.append(e);
66 await e.onRendered.first; 51 await e.onRendered.first;
67 expect(e.children.length, isNonZero, reason: 'has elements'); 52 expect(e.children.length, isNonZero, reason: 'has elements');
68 expect(e.querySelectorAll(cTag).length, equals(1)); 53 expect(e.querySelectorAll(cTag).length, equals(1));
69 (e.querySelector(rTag) as NavRefreshElement).refresh(); 54 (e.querySelector(rTag) as NavRefreshElement).refresh();
70 await e.onRendered.first; 55 await e.onRendered.first;
71 e.remove(); 56 e.remove();
72 await e.onRendered.first; 57 await e.onRendered.first;
73 expect(e.children.length, isZero, reason: 'is empty'); 58 expect(e.children.length, isZero, reason: 'is empty');
74 }); 59 });
75 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698