| Index: runtime/observatory/tests/observatory_ui/isolate_test_test.dart
|
| diff --git a/runtime/observatory/tests/observatory_ui/isolate_test_test.dart b/runtime/observatory/tests/observatory_ui/isolate_test_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ad1deee6147395b6af3be45c1b130c442bcb9a13
|
| --- /dev/null
|
| +++ b/runtime/observatory/tests/observatory_ui/isolate_test_test.dart
|
| @@ -0,0 +1,69 @@
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +import 'dart:html';
|
| +import 'dart:async';
|
| +import 'package:unittest/unittest.dart';
|
| +import 'package:observatory/repositories.dart';
|
| +import 'package:observatory/src/elements/isolate_ref.dart';
|
| +
|
| +main() {
|
| + StreamController<IsolateUpdateEvent> updatesController;
|
| + final IsolateRefMock ref = new IsolateRefMock(id: 'id', name: 'old-name');
|
| + final IsolateMock obj = new IsolateMock(id: 'id', name: 'new-name');
|
| + setUp(() {
|
| + IsolateRefElement.tag.ensureRegistration();
|
| + updatesController = new StreamController<IsolateUpdateEvent>();
|
| + });
|
| + group('instantiation', () {
|
| + test('IsolateRef', () {
|
| + final IsolateRefElement e = new IsolateRefElement(ref,
|
| + updatesController.stream);
|
| + expect(e, isNotNull, reason: 'element correctly created');
|
| + expect(e.isolate, equals(ref));
|
| + });
|
| + test('Isolate', () {
|
| + final IsolateRefElement e = new IsolateRefElement(obj,
|
| + updatesController.stream);
|
| + expect(e, isNotNull, reason: 'element correctly created');
|
| + expect(e.isolate, equals(obj));
|
| + });
|
| + });
|
| + group('elements', () {
|
| + test('created after attachment', () {
|
| + final IsolateRefElement e = new IsolateRefElement(ref,
|
| + updatesController.stream);
|
| + expect(e.shadowRoot, isNotNull, reason: 'shadowRoot is created');
|
| + expect(e.shadowRoot.children.length, isZero,
|
| + reason: 'shadowRoot is empty');
|
| + document.body.append(e);
|
| + expect(e.shadowRoot.children.length, isNonZero,
|
| + reason: 'shadowRoot has elements');
|
| + e.remove();
|
| + });
|
| + });
|
| + group('updates', () {
|
| + test('are correctly listen', () {
|
| + final IsolateRefElement e = new IsolateRefElement(ref,
|
| + updatesController.stream);
|
| + expect(updatesController.hasListener, isFalse);
|
| + document.body.append(e);
|
| + expect(updatesController.hasListener, isTrue);
|
| + e.remove();
|
| + expect(updatesController.hasListener, isFalse);
|
| + });
|
| + test('have effects', () async {
|
| + final IsolateRefElement e = new IsolateRefElement(ref,
|
| + updatesController.stream);
|
| + document.body.append(e);
|
| + expect(e.shadowRoot.innerHtml.contains(ref.id), isTrue);
|
| + Future check() async {
|
| + expect(e.shadowRoot.innerHtml.contains(ref.name), isFalse);
|
| + expect(e.shadowRoot.innerHtml.contains(obj.name), isTrue);
|
| + };
|
| + updatesController.add(new IsolateUpdateEvent(obj));
|
| + await check();
|
| + e.remove();
|
| + });
|
| + });
|
| +}
|
|
|