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

Unified Diff: runtime/observatory/tests/observatory_ui/isolate_ref_test.dart

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted error-ref tag Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/observatory_ui/isolate_ref_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/isolate_ref_test.dart b/runtime/observatory/tests/observatory_ui/isolate_ref_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5acd06733f88f0ed53755204cd26635f4ce8957e
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/isolate_ref_test.dart
@@ -0,0 +1,72 @@
+// 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';
+
+import 'helpers/webcomponents.dart';
+
+main() async{
rmacnak 2016/07/11 17:54:01 async {
cbernaschina 2016/07/11 18:14:12 This was replaced in the last version. Going to up
+ await loadWebComponents();
+ IsolateRefElement.tag.ensureRegistration();
+
+ StreamController<IsolateUpdateEvent> updatesController;
+ final IsolateRefMock ref = new IsolateRefMock(id: 'id', name: 'old-name');
+ final IsolateMock obj = new IsolateMock(id: 'id', name: 'new-name');
+ setUp(() {
+ 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.children.length, isZero,
+ reason: 'is empty');
+ document.body.append(e);
+ expect(e.children.length, isNonZero,
+ reason: '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.innerHtml.contains(ref.id), isTrue);
+ Future check() async {
+ expect(e.innerHtml.contains(ref.name), isFalse);
+ expect(e.innerHtml.contains(obj.name), isTrue);
+ };
+ updatesController.add(new IsolateUpdateEvent(obj));
+ await check();
+ e.remove();
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698