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

Unified Diff: tracing/tracing/metrics/system_health/memory_metric_test.html

Issue 2334233003: Merge NumericValue into Histogram (Closed)
Patch Set: fix rail_power_metric 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 side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/metrics/system_health/memory_metric_test.html
diff --git a/tracing/tracing/metrics/system_health/memory_metric_test.html b/tracing/tracing/metrics/system_health/memory_metric_test.html
index f3cd10b703d870032f87827195f1f51d411aee5a..fb2539ea50e7f115d953740561e87bbc441744fd 100644
--- a/tracing/tracing/metrics/system_health/memory_metric_test.html
+++ b/tracing/tracing/metrics/system_health/memory_metric_test.html
@@ -12,7 +12,6 @@ found in the LICENSE file.
<link rel="import" href="/tracing/model/container_memory_dump.html">
<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/value.html">
<link rel="import" href="/tracing/value/value_set.html">
<script>
@@ -42,7 +41,7 @@ tr.b.unittest.testSuite(function() {
var model = tr.c.TestUtils.newModel(modelCallback);
var valueNameToValues = {};
var fakeValueList = {
- addValue: function(value) {
+ addHistogram: function(value) {
var values = valueNameToValues[value.name];
if (values === undefined)
valueNameToValues[value.name] = values = [];
@@ -86,35 +85,34 @@ tr.b.unittest.testSuite(function() {
tr.b.iterItems(valueNameToValues, function(valueName, actualValues) {
assert.lengthOf(actualValues, 1,
'Multiple \'' + valueName + '\' values');
- var actualValue = actualValues[0];
- assert.instanceOf(actualValue, tr.v.NumericValue);
+ var actualHistogram = actualValues[0];
+ assert.instanceOf(actualHistogram, tr.v.Histogram);
- var actualNumeric = actualValue.numeric;
- var expectedNumeric = expectedNumerics[valueName];
- assert.strictEqual(actualNumeric.unit, expectedNumeric.unit,
+ var expectedHistogram = expectedNumerics[valueName];
+ assert.strictEqual(actualHistogram.unit, expectedHistogram.unit,
'Invalid \'' + valueName + '\' unit (expected: ' +
- expectedNumeric.unit.unitName, + ', actual: ' +
- actualNumeric.unit.unitName + ')');
+ expectedHistogram.unit.unitName, + ', actual: ' +
+ actualHistogram.unit.unitName + ')');
- if (!(expectedNumeric.value instanceof Array))
+ if (!(expectedHistogram.value instanceof Array))
assert.fail('Test sanity check: expected value must be an array');
- assert.instanceOf(actualNumeric, tr.v.Histogram,
+ assert.instanceOf(actualHistogram, tr.v.Histogram,
'Invalid \'' + valueName + '\' class');
- assert.strictEqual(actualNumeric.numValues,
- expectedNumeric.value.length,
+ assert.strictEqual(actualHistogram.numValues,
+ expectedHistogram.value.length,
'Invalid \'' + valueName + '\' Histogram numValues');
- assert.closeTo(actualNumeric.sum,
- expectedNumeric.value.reduce((a, b) => a + b, 0), SIZE_DELTA,
+ assert.closeTo(actualHistogram.sum,
+ expectedHistogram.value.reduce((a, b) => a + b, 0), SIZE_DELTA,
'Invalid \'' + valueName + '\' Histogram sum');
// Check that the bin counts match.
var binToCount = new Map();
- expectedNumeric.value.forEach(function(value) {
- var bin = actualNumeric.getBinForValue(value);
+ expectedHistogram.value.forEach(function(value) {
+ var bin = actualHistogram.getBinForValue(value);
binToCount.set(bin, (binToCount.get(bin) || 0) + 1);
});
- actualNumeric.allBins.forEach(function(bin) {
+ actualHistogram.allBins.forEach(function(bin) {
binToCount.set(bin, (binToCount.get(bin) || 0) - bin.count);
});
binToCount.forEach(function(count, bin) {
@@ -124,7 +122,7 @@ tr.b.unittest.testSuite(function() {
// Check that the description matches expectations.
assert.strictEqual(
- actualValue.description, expectedNumeric.description,
+ actualHistogram.description, expectedHistogram.description,
'Invalid \'' + valueName + '\' description');
});
});
« no previous file with comments | « tracing/tracing/metrics/system_health/memory_metric.html ('k') | tracing/tracing/metrics/system_health/power_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698