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

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

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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
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( 16 final script = new ScriptMock(id: script_id, uri: 'package/$file',
17 id: script_id, 17 tokenToLine: (int token) => 1, tokenToCol: (int token) => 2);
18 uri: 'package/$file', 18 final location = new SourceLocationMock(script: script, tokenPos: 0,
19 tokenToLine: (int token) => 1, 19 endTokenPos: 1);
20 tokenToCol: (int token) => 2);
21 final location =
22 new SourceLocationMock(script: script, tokenPos: 0, endTokenPos: 1);
23 final repository = new ScriptRepositoryMock(); 20 final repository = new ScriptRepositoryMock();
24 test('instantiation', () { 21 test('instantiation', () {
25 final e = new SourceLinkElement(isolate, location, repository); 22 final e = new SourceLinkElement(isolate, location, repository);
26 expect(e, isNotNull, reason: 'element correctly created'); 23 expect(e, isNotNull, reason: 'element correctly created');
27 expect(e.isolate, equals(isolate)); 24 expect(e.isolate, equals(isolate));
28 expect(e.location, equals(location)); 25 expect(e.location, equals(location));
29 }); 26 });
30 test('elements created after attachment', () async { 27 test('elements created after attachment', () async {
31 bool rendered = false; 28 bool rendered = false;
32 final repository = new ScriptRepositoryMock( 29 final repository = new ScriptRepositoryMock(
33 getter: expectAsync((isolate, id) async { 30 getter: expectAsync((isolate, id) async {
34 expect(rendered, isFalse); 31 expect(rendered, isFalse);
35 expect(id, equals(script_id)); 32 expect(id, equals(script_id));
36 return script; 33 return script;
37 }, count: 1)); 34 }, count: 1)
35 );
38 final e = new SourceLinkElement(isolate, location, repository); 36 final e = new SourceLinkElement(isolate, location, repository);
39 document.body.append(e); 37 document.body.append(e);
40 await e.onRendered.first; 38 await e.onRendered.first;
41 rendered = true; 39 rendered = true;
42 expect(e.children.length, isNonZero, reason: 'has elements'); 40 expect(e.children.length, isNonZero, reason: 'has elements');
43 expect(e.innerHtml.contains(isolate.id), isTrue, 41 expect(e.innerHtml.contains(isolate.id), isTrue,
44 reason: 'no message in the component'); 42 reason: 'no message in the component');
45 expect(e.innerHtml.contains(file), isTrue, 43 expect(e.innerHtml.contains(file), isTrue,
46 reason: 'no message in the component'); 44 reason: 'no message in the component');
47 e.remove(); 45 e.remove();
48 await e.onRendered.first; 46 await e.onRendered.first;
49 expect(e.children.length, isZero, reason: 'is empty'); 47 expect(e.children.length, isZero,
48 reason: 'is empty');
50 }); 49 });
51 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698