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

Side by Side Diff: tracing/tracing/value/ui/scalar_span_test.html

Issue 2293533002: Refactor NumericBuilder to HistogramBinBoundaries. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2015 The Chromium Authors. All rights reserved. 3 Copyright 2015 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/value/histogram.html"> 8 <link rel="import" href="/tracing/value/histogram.html">
9 <link rel="import" href="/tracing/value/time_display_mode.html"> 9 <link rel="import" href="/tracing/value/time_display_mode.html">
10 <link rel="import" href="/tracing/value/ui/scalar_span.html"> 10 <link rel="import" href="/tracing/value/ui/scalar_span.html">
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 expectedColor: 'rgb(0, 0, 0)', 208 expectedColor: 'rgb(0, 0, 0)',
209 significance: tr.v.Significance.SIGNIFICANT, 209 significance: tr.v.Significance.SIGNIFICANT,
210 expectedEmoji: '' 210 expectedEmoji: ''
211 }); 211 });
212 }); 212 });
213 213
214 test('instantiate', function() { 214 test('instantiate', function() {
215 checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMs, 215 checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMs,
216 '123.457 ms'); 216 '123.457 ms');
217 checkScalarSpan(this, 0, Unit.byName.normalizedPercentage, '0.000%'); 217 checkScalarSpan(this, 0, Unit.byName.normalizedPercentage, '0.000%');
218 checkScalarSpan(this, 1, Unit.byName.normalizedPercentage, '100.000%');
218 checkScalarSpan(this, -2560, Unit.byName.sizeInBytes, '-2.5 KiB'); 219 checkScalarSpan(this, -2560, Unit.byName.sizeInBytes, '-2.5 KiB');
219 }); 220 });
220 221
221 test('instantiate_smallerIsBetter', function() { 222 test('instantiate_smallerIsBetter', function() {
222 checkScalarSpan(this, 45097156608, Unit.byName.sizeInBytes_smallerIsBetter, 223 checkScalarSpan(this, 45097156608, Unit.byName.sizeInBytes_smallerIsBetter,
223 '42.0 GiB'); 224 '42.0 GiB');
224 checkScalarSpan(this, 0, Unit.byName.energyInJoules_smallerIsBetter, 225 checkScalarSpan(this, 0, Unit.byName.energyInJoules_smallerIsBetter,
225 '0.000 J'); 226 '0.000 J');
226 checkScalarSpan(this, -0.25, Unit.byName.unitlessNumber_smallerIsBetter, 227 checkScalarSpan(this, -0.25, Unit.byName.unitlessNumber_smallerIsBetter,
227 '-0.250'); 228 '-0.250');
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 test('instantiate_withWarning', function() { 335 test('instantiate_withWarning', function() {
335 var span = document.createElement('tr-v-ui-scalar-span'); 336 var span = document.createElement('tr-v-ui-scalar-span');
336 span.value = 400000000; 337 span.value = 400000000;
337 span.unit = Unit.byName.sizeInBytes; 338 span.unit = Unit.byName.sizeInBytes;
338 span.warning = 'There is a problem with this size'; 339 span.warning = 'There is a problem with this size';
339 this.addHTMLOutput(span); 340 this.addHTMLOutput(span);
340 }); 341 });
341 342
342 test('instantiate_withPercentage', function() { 343 test('instantiate_withPercentage', function() {
343 var span = document.createElement('tr-v-ui-scalar-span'); 344 var span = document.createElement('tr-v-ui-scalar-span');
344 span.value = new ScalarNumeric(Unit.byName.unitlessNumber, 99); 345 span.value = new ScalarNumeric(Unit.byName.unitlessNumber, 0.99);
345 span.percentage = 0.66; 346 span.percentage = 0.66;
346 this.addHTMLOutput(span); 347 this.addHTMLOutput(span);
347 }); 348 });
348 349
349 test('instantiate_withRightAlign', function() { 350 test('instantiate_withRightAlign', function() {
350 var span = document.createElement('tr-v-ui-scalar-span'); 351 var span = document.createElement('tr-v-ui-scalar-span');
351 span.value = new ScalarNumeric(Unit.byName.timeStampInMs, 5.777); 352 span.value = new ScalarNumeric(Unit.byName.timeStampInMs, 5.777);
352 span.rightAlign = true; 353 span.rightAlign = true;
353 this.addHTMLOutput(span); 354 this.addHTMLOutput(span);
354 }); 355 });
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 addAndCheckScalarSpan(0, 'block', 1); 418 addAndCheckScalarSpan(0, 'block', 1);
418 addAndCheckScalarSpan(0.05, 'block', 5); 419 addAndCheckScalarSpan(0.05, 'block', 5);
419 addAndCheckScalarSpan(0.5, 'block', 50); 420 addAndCheckScalarSpan(0.5, 'block', 50);
420 addAndCheckScalarSpan(0.95, 'block', 95); 421 addAndCheckScalarSpan(0.95, 'block', 95);
421 addAndCheckScalarSpan(1, 'block', 100); 422 addAndCheckScalarSpan(1, 'block', 100);
422 }); 423 });
423 424
424 test('emptyNumeric', function() { 425 test('emptyNumeric', function() {
425 assert.strictEqual(tr.v.ui.createScalarSpan(), ''); 426 assert.strictEqual(tr.v.ui.createScalarSpan(), '');
426 427
427 var numeric = tr.v.NumericBuilder.createLinear( 428 var value = new tr.v.NumericValue(
428 tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000), 429 'foo', new tr.v.Histogram(tr.v.Unit.byName.count));
429 10).build();
430 var value = new tr.v.NumericValue('foo', numeric);
431 assert.strictEqual(tr.v.ui.createScalarSpan(value), ''); 430 assert.strictEqual(tr.v.ui.createScalarSpan(value), '');
432 }); 431 });
433 }); 432 });
434 </script> 433 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/value/ui/related_value_set_span_test.html ('k') | tracing/tracing/value/ui/value_set_table_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698