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

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

Issue 2180553002: Converted Observatory source-link & script-ref elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted Observatory source-link & script-ref elements 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/source_link/element_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/source_link/element_test.dart b/runtime/observatory/tests/observatory_ui/source_link/element_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2d4cfba336b8eb22a0688c6de71ae36a7bb1a5ec
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/source_link/element_test.dart
@@ -0,0 +1,46 @@
+// 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/mocks.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:observatory/src/elements/source_link.dart';
+
+main() {
+ SourceLinkElement.tag.ensureRegistration();
+
+ final M.IsolateRef isolate = const IsolateRefMock(id: 'isolate-id');
+ final M.Script script = new ScriptMock(id: 'script-id',
+ uri: 'package/filename.dart',
+ tokenToLine: (int token) => 1,
+ tokenToCol: (int token) => 2);
+ final M.SourceLocation location = new SourceLocationMock(script: script,
+ tokenPos: 0, endTokenPos: 1);
+ M.ScriptRepository repository;
+ setUp(() {
+ repository = new ScriptRepositoryMock({ 'script-id': script });
+ });
+ test('instantiation', () {
+ final SourceLinkElement e = new SourceLinkElement(isolate, location,
+ repository);
+ expect(e, isNotNull, reason: 'element correctly created');
+ expect(e.isolate, equals(isolate));
+ expect(e.location, equals(location));
+ });
+ test('elements created after attachment', () async {
+ final SourceLinkElement e = new SourceLinkElement(isolate, location,
+ repository);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.innerHtml.contains(isolate.id), isTrue,
+ reason: 'no message in the component');
+ expect(e.innerHtml.contains('filename.dart'), isTrue,
+ reason: 'no message in the component');
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero,
+ reason: 'is empty');
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698