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

Unified Diff: runtime/observatory/tests/observatory_ui/nav/notify_exception/exception_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 vm-connect 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/nav/notify_exception/exception_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/nav/notify_exception/exception_test.dart b/runtime/observatory/tests/observatory_ui/nav/notify_exception/exception_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c52b2eed9ecdc7dae2fbb02dcd038f48649563ee
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/nav/notify_exception/exception_test.dart
@@ -0,0 +1,57 @@
+// 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/nav/notify_exception.dart';
+
+main() {
+ NavNotifyExceptionElement.tag.ensureRegistration();
+
+ final StackTrace stacktrace = new StackTrace.fromString('stacktrace string');
+ group('normal exception', () {
+ final Exception exception = new Exception('exception message');
+ group('instantiation', () {
+ test('no stacktrace', () {
+ final NavNotifyExceptionElement e =
+ new NavNotifyExceptionElement(exception);
+ expect(e, isNotNull, reason: 'element correctly created');
+ expect(e.exception, equals(exception));
+ expect(e.stacktrace, isNull);
+ });
+ test('with stacktrace', () {
+ final NavNotifyExceptionElement e =
+ new NavNotifyExceptionElement(exception, stacktrace: stacktrace);
+ expect(e, isNotNull, reason: 'element correctly created');
+ expect(e.exception, equals(exception));
+ expect(e.stacktrace, equals(stacktrace));
+ });
+ });
+ group('elements', () {
+ test('created after attachment (no stacktrace)', () async {
+ final NavNotifyExceptionElement e =
+ new NavNotifyExceptionElement(exception);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.innerHtml.contains(exception.toString()), isTrue);
+ expect(e.innerHtml.contains(stacktrace.toString()), isFalse);
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero, reason: 'is empty');
+ });
+ test('created after attachment (with stacktrace)', () async {
+ final NavNotifyExceptionElement e =
+ new NavNotifyExceptionElement(exception, stacktrace: stacktrace);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.innerHtml.contains(exception.toString()), isTrue);
+ expect(e.innerHtml.contains(stacktrace.toString()), isTrue);
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero, reason: 'is empty');
+ });
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698