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

Side by Side Diff: runtime/observatory/tests/observatory_ui/source_link/element_test.dart

Issue 2274013006: Converted Observatory objectstore-view element (Closed)
Patch Set: Fixed link color Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « runtime/observatory/tests/observatory_ui/objectstore_view/element_test.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/src/elements/source_link.dart'; 7 import 'package:observatory/src/elements/source_link.dart';
8 import '../mocks.dart'; 8 import '../mocks.dart';
9 9
10 main() { 10 main() {
11 SourceLinkElement.tag.ensureRegistration(); 11 SourceLinkElement.tag.ensureRegistration();
12 12
13 const isolate = const IsolateRefMock(id: 'isolate-id'); 13 const isolate = const IsolateRefMock(id: 'isolate-id');
14 const script_id = 'script-id'; 14 const script_id = 'script-id';
15 const file = 'filename.dart'; 15 const file = 'filename.dart';
16 final script = new ScriptMock(id: script_id, uri: 'package/$file', 16 final script = new ScriptMock(id: script_id, uri: 'package/$file',
17 tokenToLine: (int token) => 1, tokenToCol: (int token) => 2); 17 tokenToLine: (int token) => 1, tokenToCol: (int token) => 2);
18 final location = new SourceLocationMock(script: script, tokenPos: 0, 18 final location = new SourceLocationMock(script: script, tokenPos: 0,
19 endTokenPos: 1); 19 endTokenPos: 1);
20 final repository = new ScriptRepositoryMock();
20 test('instantiation', () { 21 test('instantiation', () {
21 final e = new SourceLinkElement(isolate, location, 22 final e = new SourceLinkElement(isolate, location, repository);
22 new ScriptRepositoryMock());
23 expect(e, isNotNull, reason: 'element correctly created'); 23 expect(e, isNotNull, reason: 'element correctly created');
24 expect(e.isolate, equals(isolate)); 24 expect(e.isolate, equals(isolate));
25 expect(e.location, equals(location)); 25 expect(e.location, equals(location));
26 }); 26 });
27 test('elements created after attachment', () async { 27 test('elements created after attachment', () async {
28 bool rendered = false; 28 bool rendered = false;
29 final e = new SourceLinkElement(isolate, location, 29 final repository = new ScriptRepositoryMock(
30 new ScriptRepositoryMock(getter: expectAsync((String id) async { 30 getter: expectAsync((isolate, id) async {
31 expect(rendered, isFalse); 31 expect(rendered, isFalse);
32 expect(id, equals(script_id)); 32 expect(id, equals(script_id));
33 return script; 33 return script;
34 }, count: 1))); 34 }, count: 1)
35 );
36 final e = new SourceLinkElement(isolate, location, repository);
35 document.body.append(e); 37 document.body.append(e);
36 await e.onRendered.first; 38 await e.onRendered.first;
37 rendered = true; 39 rendered = true;
38 expect(e.children.length, isNonZero, reason: 'has elements'); 40 expect(e.children.length, isNonZero, reason: 'has elements');
39 expect(e.innerHtml.contains(isolate.id), isTrue, 41 expect(e.innerHtml.contains(isolate.id), isTrue,
40 reason: 'no message in the component'); 42 reason: 'no message in the component');
41 expect(e.innerHtml.contains(file), isTrue, 43 expect(e.innerHtml.contains(file), isTrue,
42 reason: 'no message in the component'); 44 reason: 'no message in the component');
43 e.remove(); 45 e.remove();
44 await e.onRendered.first; 46 await e.onRendered.first;
45 expect(e.children.length, isZero, 47 expect(e.children.length, isZero,
46 reason: 'is empty'); 48 reason: 'is empty');
47 }); 49 });
48 } 50 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/observatory_ui/objectstore_view/element_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698