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

Side by Side Diff: runtime/observatory/tests/observatory_ui/cpu_profile/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 '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/cpu_profile.dart'; 9 import 'package:observatory/src/elements/cpu_profile.dart';
10 import 'package:observatory/src/elements/cpu_profile/virtual_tree.dart'; 10 import 'package:observatory/src/elements/cpu_profile/virtual_tree.dart';
(...skipping 11 matching lines...) Expand all
22 const vm = const VMMock(); 22 const vm = const VMMock();
23 const isolate = const IsolateRefMock(); 23 const isolate = const IsolateRefMock();
24 final events = new EventRepositoryMock(); 24 final events = new EventRepositoryMock();
25 final notifs = new NotificationRepositoryMock(); 25 final notifs = new NotificationRepositoryMock();
26 test('instantiation', () { 26 test('instantiation', () {
27 final profiles = new IsolateSampleProfileRepositoryMock(); 27 final profiles = new IsolateSampleProfileRepositoryMock();
28 final e = new CpuProfileElement(vm, isolate, events, notifs, profiles); 28 final e = new CpuProfileElement(vm, isolate, events, notifs, profiles);
29 expect(e, isNotNull, reason: 'element correctly created'); 29 expect(e, isNotNull, reason: 'element correctly created');
30 }); 30 });
31 test('elements created', () async { 31 test('elements created', () async {
32 final controller = 32 final controller
33 new StreamController<M.SampleProfileLoadingProgressEvent>.broadcast(); 33 = new StreamController<M.SampleProfileLoadingProgressEvent>.broadcast();
34 final profiles = new IsolateSampleProfileRepositoryMock(getter: 34 final profiles = new IsolateSampleProfileRepositoryMock(
35 (M.IsolateRef i, M.SampleProfileTag t, bool clear, bool forceFetch) { 35 getter: (M.IsolateRef i, M.SampleProfileTag t, bool clear,
36 expect(i, equals(isolate)); 36 bool forceFetch) {
37 expect(t, isNotNull); 37 expect(i, equals(isolate));
38 expect(clear, isFalse); 38 expect(t, isNotNull);
39 expect(forceFetch, isFalse); 39 expect(clear, isFalse);
40 return controller.stream; 40 expect(forceFetch, isFalse);
41 }); 41 return controller.stream;
42 }
43 );
42 final e = new CpuProfileElement(vm, isolate, events, notifs, profiles); 44 final e = new CpuProfileElement(vm, isolate, events, notifs, profiles);
43 document.body.append(e); 45 document.body.append(e);
44 await e.onRendered.first; 46 await e.onRendered.first;
45 expect(e.children.length, isNonZero, reason: 'has elements'); 47 expect(e.children.length, isNonZero, reason: 'has elements');
46 expect(e.querySelectorAll(sTag).length, isZero); 48 expect(e.querySelectorAll(sTag).length, isZero);
47 expect(e.querySelectorAll(cTag).length, isZero); 49 expect(e.querySelectorAll(cTag).length, isZero);
48 expect(e.querySelectorAll(tTag).length, isZero); 50 expect(e.querySelectorAll(tTag).length, isZero);
49 controller.add(new SampleProfileLoadingProgressEventMock( 51 controller.add(new SampleProfileLoadingProgressEventMock(
50 progress: new SampleProfileLoadingProgressMock( 52 progress: new SampleProfileLoadingProgressMock(
51 status: M.SampleProfileLoadingStatus.fetching))); 53 status: M.SampleProfileLoadingStatus.fetching
54 )
55 ));
52 await e.onRendered.first; 56 await e.onRendered.first;
53 expect(e.querySelectorAll(sTag).length, equals(1)); 57 expect(e.querySelectorAll(sTag).length, equals(1));
54 expect(e.querySelectorAll(cTag).length, isZero); 58 expect(e.querySelectorAll(cTag).length, isZero);
55 expect(e.querySelectorAll(tTag).length, isZero); 59 expect(e.querySelectorAll(tTag).length, isZero);
56 controller.add(new SampleProfileLoadingProgressEventMock( 60 controller.add(new SampleProfileLoadingProgressEventMock(
57 progress: new SampleProfileLoadingProgressMock( 61 progress: new SampleProfileLoadingProgressMock(
58 status: M.SampleProfileLoadingStatus.loading))); 62 status: M.SampleProfileLoadingStatus.loading
63 )
64 ));
59 controller.add(new SampleProfileLoadingProgressEventMock( 65 controller.add(new SampleProfileLoadingProgressEventMock(
60 progress: new SampleProfileLoadingProgressMock( 66 progress: new SampleProfileLoadingProgressMock(
61 status: M.SampleProfileLoadingStatus.loaded, 67 status: M.SampleProfileLoadingStatus.loaded,
62 profile: new SampleProfileMock()))); 68 profile: new SampleProfileMock()
69 )
70 ));
63 controller.close(); 71 controller.close();
64 await e.onRendered.first; 72 await e.onRendered.first;
65 expect(e.querySelectorAll(sTag).length, equals(1)); 73 expect(e.querySelectorAll(sTag).length, equals(1));
66 expect(e.querySelectorAll(cTag).length, equals(1)); 74 expect(e.querySelectorAll(cTag).length, equals(1));
67 expect(e.querySelectorAll(tTag).length, equals(1)); 75 expect(e.querySelectorAll(tTag).length, equals(1));
68 e.remove(); 76 e.remove();
69 await e.onRendered.first; 77 await e.onRendered.first;
70 expect(e.children.length, isZero, reason: 'is empty'); 78 expect(e.children.length, isZero, reason: 'is empty');
71 }); 79 });
72 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698