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

Unified Diff: runtime/observatory/tests/observatory_ui/class_tree/element_test.dart

Issue 2212253002: Converted Observatory class-tree element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed tmp code Created 4 years, 4 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/class_tree/element_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/class_tree/element_test.dart b/runtime/observatory/tests/observatory_ui/class_tree/element_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..518613f8840cc7e6f1dc7591a47ceb83783acfb7
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/class_tree/element_test.dart
@@ -0,0 +1,64 @@
+// 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 'package:unittest/unittest.dart';
+import 'package:observatory/src/elements/class_tree.dart';
+import 'package:observatory/src/elements/nav/notify.dart';
+import '../mocks.dart';
+
+main() {
+ ClassTreeElement.tag.ensureRegistration();
+
+ final nTag = NavNotifyElement.tag.name;
+ const vm = const VMMock();
+ const isolate = const IsolateRefMock();
+ final events = new EventRepositoryMock();
+ final notifications = new NotificationRepositoryMock();
+
+ group('instantiation', () {
+ test('default', () {
+ final e = new ClassTreeElement(vm, isolate, events, notifications,
+ new ClassRepositoryMock());
+ expect(e, isNotNull, reason: 'element correctly created');
+ });
+ });
+ group('elements', () {
+ test('created after attachment', () async {
+ const child2_id = 'c2-id';
+ const child1_1_id = 'c1_1-id';
+ const child1_id = 'c1-id';
+ const child2 = const ClassMock(id: child2_id);
+ const child1_1 = const ClassMock(id: child1_1_id);
+ const child1 = const ClassMock(id: child1_id,
+ subclasses: const [child1_1]);
+ const object = const ClassMock(id: 'o-id',
+ subclasses: const [child1, child2]);
+ const ids = const [child1_id, child1_1_id, child2_id];
+ bool rendered = false;
+ final e = new ClassTreeElement(vm, isolate, events, notifications,
+ new ClassRepositoryMock(
+ object: expectAsync(() async {
+ expect(rendered, isFalse);
+ return object;
+ }, count: 1),
+ getter: expectAsync((id) async {
+ expect(ids.contains(id), isTrue);
+ switch (id) {
+ case child1_id: return child1;
+ case child1_1_id: return child1_1;
+ case child2_id: return child2;
+ default: return null;
+ }
+ }, count: 3)));
+ document.body.append(e);
+ await e.onRendered.first;
+ rendered = true;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.querySelectorAll(nTag).length, equals(1));
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero, reason: 'is empty');
+ });
+ });
+}
« no previous file with comments | « runtime/observatory/observatory_sources.gypi ('k') | runtime/observatory/tests/observatory_ui/class_tree/element_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698