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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. 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/curly_block.dart'; 7 import 'package:observatory/src/elements/curly_block.dart';
8 import 'package:observatory/src/elements/instance_ref.dart'; 8 import 'package:observatory/src/elements/instance_ref.dart';
9 import 'package:observatory/src/elements/retaining_path.dart'; 9 import 'package:observatory/src/elements/retaining_path.dart';
10 import '../mocks.dart'; 10 import '../mocks.dart';
11 11
12 main() { 12 main() {
13 RetainingPathElement.tag.ensureRegistration(); 13 RetainingPathElement.tag.ensureRegistration();
14 14
15 final cTag = CurlyBlockElement.tag.name; 15 final cTag = CurlyBlockElement.tag.name;
16 final iTag = InstanceRefElement.tag.name; 16 final iTag = InstanceRefElement.tag.name;
17 17
18 const isolate = const IsolateRefMock(); 18 const isolate = const IsolateRefMock();
19 const object = const InstanceRefMock(); 19 const object = const InstanceRefMock();
20 final paths = new RetainingPathRepositoryMock(); 20 final paths = new RetainingPathRepositoryMock();
21 final instances = new InstanceRepositoryMock(); 21 final instances = new InstanceRepositoryMock();
22 test('instantiation', () { 22 test('instantiation', () {
23 final e = new RetainingPathElement(isolate, object, paths, instances); 23 final e = new RetainingPathElement(isolate, object, paths, instances);
24 expect(e, isNotNull, reason: 'element correctly created'); 24 expect(e, isNotNull, reason: 'element correctly created');
25 expect(e.isolate, equals(isolate)); 25 expect(e.isolate, equals(isolate));
26 expect(e.object, equals(object)); 26 expect(e.object, equals(object));
27 }); 27 });
28 test('elements created after attachment', () async { 28 test('elements created after attachment', () async {
29 const source = const InstanceRefMock(id: 'source-id', name: 'source_name'); 29 const source = const InstanceRefMock(id: 'source-id', name: 'source_name');
30 const path = const RetainingPathMock(elements: const [ 30 const path = const RetainingPathMock(
31 const RetainingPathItemMock(source: source) 31 elements: const [const RetainingPathItemMock(source: source)]);
32 ]);
33 bool invoked = false; 32 bool invoked = false;
34 final paths = new RetainingPathRepositoryMock( 33 final paths = new RetainingPathRepositoryMock(
35 getter: expectAsync((i, id) async { 34 getter: expectAsync((i, id) async {
36 expect(i, equals(isolate)); 35 expect(i, equals(isolate));
37 expect(id, equals(object.id)); 36 expect(id, equals(object.id));
38 invoked = true; 37 invoked = true;
39 return path; 38 return path;
40 }, count: 1) 39 }, count: 1));
41 );
42 final instances = new InstanceRepositoryMock(); 40 final instances = new InstanceRepositoryMock();
43 final e = new RetainingPathElement(isolate, object, paths, instances); 41 final e = new RetainingPathElement(isolate, object, paths, instances);
44 document.body.append(e); 42 document.body.append(e);
45 await e.onRendered.first; 43 await e.onRendered.first;
46 expect(invoked, isFalse); 44 expect(invoked, isFalse);
47 expect(e.children.length, isNonZero, reason: 'has elements'); 45 expect(e.children.length, isNonZero, reason: 'has elements');
48 expect(e.querySelectorAll(iTag).length, isZero); 46 expect(e.querySelectorAll(iTag).length, isZero);
49 (e.querySelector(cTag) as CurlyBlockElement).toggle(); 47 (e.querySelector(cTag) as CurlyBlockElement).toggle();
50 await e.onRendered.first; 48 await e.onRendered.first;
51 expect(invoked, isTrue); 49 expect(invoked, isTrue);
52 expect(e.querySelectorAll(iTag).length, equals(1)); 50 expect(e.querySelectorAll(iTag).length, equals(1));
53 e.remove(); 51 e.remove();
54 await e.onRendered.first; 52 await e.onRendered.first;
55 expect(e.children.length, isZero, reason: 'is empty'); 53 expect(e.children.length, isZero, reason: 'is empty');
56 }); 54 });
57 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698