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

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

Issue 2267863002: Converted Observatory ports-page element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed indentation 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/src/elements/ports.dart';
8 import '../mocks.dart';
9
10 main() {
11 PortsElement.tag.ensureRegistration();
12
13 const vm = const VMMock();
14 const isolate = const IsolateRefMock();
15 final events = new EventRepositoryMock();
16 final notifs = new NotificationRepositoryMock();
17 final ports = new PortsRepositoryMock();
18 final instances = new InstanceRepositoryMock();
19 test('instantiation', () {
20 final e = new PortsElement(vm, isolate, events, notifs, ports, instances);
21 expect(e, isNotNull, reason: 'element correctly created');
22 expect(e.isolate, equals(isolate));
23 expect(e.ports, equals(ports));
24 });
25 test('elements created after attachment', () async {
26 const elements = const [
27 const PortMock(name: 'port-1'),
28 const PortMock(name: 'port-2'),
29 const PortMock(name: 'port-3')
30 ];
31 const isolatePorts = const PortsMock(elements: elements);
32 final ports = new PortsRepositoryMock(
33 getter: expectAsync((i) async {
34 expect(i, equals(isolate));
35 return isolatePorts;
36 }, count: 1)
37 );
38 final instances = new InstanceRepositoryMock();
39 final e = new PortsElement(vm, isolate, events, notifs, ports, instances);
40 document.body.append(e);
41 await e.onRendered.first;
42 expect(e.children.length, isNonZero, reason: 'has elements');
43 expect(e.querySelectorAll('.port-number').length, equals(elements.length));
44 e.remove();
45 await e.onRendered.first;
46 expect(e.children.length, isZero, reason: 'is empty');
47 });
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698