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

Unified Diff: tracing/tracing/value/ui/generic_set_span_test.html

Issue 3008203002: Format traceUrls in generic-set-span. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/value/ui/generic_set_span.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/value/ui/generic_set_span_test.html
diff --git a/tracing/tracing/value/ui/generic_set_span_test.html b/tracing/tracing/value/ui/generic_set_span_test.html
index 9fafb5c8a06f761e9abd0f095eeffaed3a52f6ff..18cd22571a0428125c0b7dc6c7a0400cde4ca31b 100644
--- a/tracing/tracing/value/ui/generic_set_span_test.html
+++ b/tracing/tracing/value/ui/generic_set_span_test.html
@@ -21,39 +21,79 @@ tr.b.unittest.testSuite(function() {
this.addHTMLOutput(span);
});
- test('strings', async function() {
+ test('strings', function() {
const diagnostic = new tr.v.d.GenericSet([
'foo', 'bar', 1, 0, Infinity, NaN,
]);
const span = tr.v.ui.createDiagnosticSpan(diagnostic);
assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName);
this.addHTMLOutput(span);
- await tr.b.animationFrame();
- assert.lengthOf(tr.ui.b.findDeepElementsMatchingPredicate(
- span, e => e.tagName === 'DIV' && e.id === ''), diagnostic.size);
+ const links = tr.ui.b.findDeepElementsMatching(span, 'a');
+ assert.lengthOf(links, diagnostic.size);
+ assert.strictEqual(links[0].textContent, '0');
+ assert.strictEqual(links[0].href, '');
+ assert.strictEqual(links[1].textContent, '1');
+ assert.strictEqual(links[1].href, '');
+ assert.strictEqual(links[2].textContent, 'Infinity');
+ assert.strictEqual(links[2].href, '');
+ assert.strictEqual(links[3].textContent, 'NaN');
+ assert.strictEqual(links[3].href, '');
+ assert.strictEqual(links[4].textContent, 'bar');
+ assert.strictEqual(links[4].href, '');
+ assert.strictEqual(links[5].textContent, 'foo');
+ assert.strictEqual(links[5].href, '');
});
- test('numbers', async function() {
+ test('numbers', function() {
const diagnostic = new tr.v.d.GenericSet([10, 1, 0, 2, 11]);
const span = tr.v.ui.createDiagnosticSpan(diagnostic);
assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName);
this.addHTMLOutput(span);
- await tr.b.animationFrame();
- assert.lengthOf(tr.ui.b.findDeepElementsMatchingPredicate(
- span, e => e.tagName === 'DIV' && e.id === ''), diagnostic.size);
+ const links = tr.ui.b.findDeepElementsMatching(span, 'a');
+ assert.lengthOf(links, diagnostic.size);
+ assert.strictEqual(links[0].textContent, '0');
+ assert.strictEqual(links[0].href, '');
+ assert.strictEqual(links[1].textContent, '1');
+ assert.strictEqual(links[1].href, '');
+ assert.strictEqual(links[2].textContent, '2');
+ assert.strictEqual(links[2].href, '');
+ assert.strictEqual(links[3].textContent, '10');
+ assert.strictEqual(links[3].href, '');
+ assert.strictEqual(links[4].textContent, '11');
+ assert.strictEqual(links[4].href, '');
});
- test('urls', async function() {
- const diagnostic = new tr.v.d.GenericSet([
- 'http://cnn.com/',
+ test('urls', function() {
+ const urls = [
'http://google.com/',
- ]);
- const span = tr.v.ui.createDiagnosticSpan(diagnostic);
+ 'http://cnn.com/',
+ ];
+ const span = tr.v.ui.createDiagnosticSpan(new tr.v.d.GenericSet(urls));
+ assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName);
+ this.addHTMLOutput(span);
+ const links = tr.ui.b.findDeepElementsMatching(span, 'a');
+ assert.lengthOf(links, urls.length);
+ assert.strictEqual(links[0].textContent, urls[1]);
+ assert.strictEqual(links[0].href, urls[1]);
+ assert.strictEqual(links[1].textContent, urls[0]);
+ assert.strictEqual(links[1].href, urls[0]);
+ });
+
+ test('traceUrls', function() {
+ const urls = [
+ 'https://console.developers.google.com/m/cloudstorage/b/chromium-telemetry/o/c.html',
+ 'file://d/e/f.html',
+ ];
+ const span = tr.v.ui.createDiagnosticSpan(
+ new tr.v.d.GenericSet(urls), tr.v.d.RESERVED_NAMES.TRACE_URLS);
assert.strictEqual('TR-V-UI-GENERIC-SET-SPAN', span.tagName);
this.addHTMLOutput(span);
- await tr.b.animationFrame();
- assert.lengthOf(tr.ui.b.findDeepElementsMatching(span, 'a'),
- diagnostic.size);
+ const links = tr.ui.b.findDeepElementsMatching(span, 'a');
+ assert.lengthOf(links, urls.length);
+ assert.strictEqual(links[0].textContent, 'f.html');
+ assert.strictEqual(links[0].href, urls[1]);
+ assert.strictEqual(links[1].textContent, 'c.html');
+ assert.strictEqual(links[1].href, urls[0]);
});
});
</script>
« no previous file with comments | « tracing/tracing/value/ui/generic_set_span.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698