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

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

Issue 2270013002: Converted Observatory context-view element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed access to instance function 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/context/element_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/context/element_test.dart b/runtime/observatory/tests/observatory_ui/context/element_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..428aefd179f11db2e5124cc5dc283cd72e4140e7
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/context/element_test.dart
@@ -0,0 +1,58 @@
+// 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/context_view.dart';
+import 'package:observatory/src/elements/nav/refresh.dart';
+import 'package:observatory/src/elements/object_common.dart';
+import '../mocks.dart';
+
+main() {
+ ContextViewElement.tag.ensureRegistration();
+
+ final cTag = ObjectCommonElement.tag.name;
+ final rTag = NavRefreshElement.tag.name;
+
+ const vm = const VMMock();
+ const isolate = const IsolateRefMock();
+ final events = new EventRepositoryMock();
+ final notifs = new NotificationRepositoryMock();
+ final context = const ContextMock();
+ final contexts = new ContextRepositoryMock();
+ final reachableSizes = new ReachableSizeRepositoryMock();
+ final retainedSizes = new RetainedSizeRepositoryMock();
+ final inbounds = new InboundReferencesRepositoryMock();
+ final paths = new RetainingPathRepositoryMock();
+ final instances = new InstanceRepositoryMock();
+ test('instantiation', () {
+ final e = new ContextViewElement(vm, isolate, context, events, notifs,
+ contexts, retainedSizes, reachableSizes,
+ inbounds, paths, instances);
+ expect(e, isNotNull, reason: 'element correctly created');
+ expect(e.isolate, equals(isolate));
+ expect(e.context, equals(context));
+ });
+ test('elements created after attachment', () async {
+ final contexts = new ContextRepositoryMock(
+ getter: expectAsync((i, id) async {
+ expect(i, equals(isolate));
+ expect(id, equals(context.id));
+ return context;
+ }, count: 1)
+ );
+ final e = new ContextViewElement(vm, isolate, context, events, notifs,
+ contexts, retainedSizes, reachableSizes,
+ inbounds, paths, instances);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.querySelectorAll(cTag).length, equals(1));
+ (e.querySelector(rTag) as NavRefreshElement).refresh();
+ await e.onRendered.first;
+ 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/context/element_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698