OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
| 8 <link rel="import" href="/tracing/base/raf.html"> |
| 9 <link rel="import" href="/tracing/ui/base/deep_utils.html"> |
8 <link rel="import" href="/tracing/value/diagnostics/generic_set.html"> | 10 <link rel="import" href="/tracing/value/diagnostics/generic_set.html"> |
9 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> | 11 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> |
10 | 12 |
11 <script> | 13 <script> |
12 'use strict'; | 14 'use strict'; |
13 | 15 |
14 tr.b.unittest.testSuite(function() { | 16 tr.b.unittest.testSuite(function() { |
15 test('instantiate', function() { | 17 test('instantiate', function() { |
16 const diagnostic = new tr.v.d.GenericSet([{foo: 'bar', baz: [42]}]); | 18 const diagnostic = new tr.v.d.GenericSet([{foo: 'bar', baz: [42]}]); |
17 const span = tr.v.ui.createDiagnosticSpan(diagnostic); | 19 const span = tr.v.ui.createDiagnosticSpan(diagnostic); |
18 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); | 20 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); |
19 this.addHTMLOutput(span); | 21 this.addHTMLOutput(span); |
20 }); | 22 }); |
21 | 23 |
22 test('strings', function() { | 24 test('strings', async function() { |
23 const diagnostic = new tr.v.d.GenericSet([ | 25 const diagnostic = new tr.v.d.GenericSet([ |
24 'foo', 'bar', 1, 0, Infinity, NaN, | 26 'foo', 'bar', 1, 0, Infinity, NaN, |
25 ]); | 27 ]); |
26 const span = tr.v.ui.createDiagnosticSpan(diagnostic); | 28 const span = tr.v.ui.createDiagnosticSpan(diagnostic); |
27 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); | 29 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); |
28 this.addHTMLOutput(span); | 30 this.addHTMLOutput(span); |
| 31 await tr.b.animationFrame(); |
| 32 assert.lengthOf(tr.ui.b.findDeepElementsMatchingPredicate( |
| 33 span, e => e.tagName === 'DIV' && e.id === ''), diagnostic.size); |
29 }); | 34 }); |
30 | 35 |
31 test('numbers', function() { | 36 test('numbers', async function() { |
32 const diagnostic = new tr.v.d.GenericSet([10, 1, 0, 2, 11]); | 37 const diagnostic = new tr.v.d.GenericSet([10, 1, 0, 2, 11]); |
33 const span = tr.v.ui.createDiagnosticSpan(diagnostic); | 38 const span = tr.v.ui.createDiagnosticSpan(diagnostic); |
34 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); | 39 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); |
35 this.addHTMLOutput(span); | 40 this.addHTMLOutput(span); |
| 41 await tr.b.animationFrame(); |
| 42 assert.lengthOf(tr.ui.b.findDeepElementsMatchingPredicate( |
| 43 span, e => e.tagName === 'DIV' && e.id === ''), diagnostic.size); |
| 44 }); |
| 45 |
| 46 test('urls', async function() { |
| 47 const diagnostic = new tr.v.d.GenericSet([ |
| 48 'http://cnn.com/', |
| 49 'http://google.com/', |
| 50 ]); |
| 51 const span = tr.v.ui.createDiagnosticSpan(diagnostic); |
| 52 assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName); |
| 53 this.addHTMLOutput(span); |
| 54 await tr.b.animationFrame(); |
| 55 assert.lengthOf(tr.ui.b.findDeepElementsMatching(span, 'a'), |
| 56 diagnostic.size); |
36 }); | 57 }); |
37 }); | 58 }); |
38 </script> | 59 </script> |
OLD | NEW |