blob: 611639255cfafcff44b18986589ee43bc2e97c91 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/base/base.html">
<link rel="import" href="/base/statistics.html">
<link rel="import" href="/base/xhr.html">
<link rel="import" href="/base/iteration_helpers.html">
<link rel="import" href="/extras/deep_reports/scalar_value.html">
<link rel="import" href="/extras/audits/rail_interaction_record.html">
<link rel="import" href="/extras/audits/rail_score.html">
<script>
'use strict';
tv.exportTo('tv.e.deep_reports', function() {
function RAILDeepReporter() {
};
RAILDeepReporter.addResultsForModel = function(results, page, model) {
var rirs = [];
model.interaction_records.forEach(function(ir) {
if (ir instanceof tv.e.audits.RAILInteractionRecord)
rirs.push(ir);
});
if (rirs.length === 0)
return;
var railScore = tv.e.audits.RAILScore.compute(rirs);
results.addValue(
new tv.e.deep_reports.ScalarValue(
page, 'numRailIRs', 'ms', rirs.length));
tv.b.iterItems(railScore, function(key, value) {
if (key === 'score')
return;
results.addValue(
new tv.e.deep_reports.ScalarValue(
page, key, 'rails', value));
});
results.addValue(
new tv.e.deep_reports.ScalarValue(
page, 'railScore', 'rails', railScore.score));
}
return {
RAILDeepReporter: RAILDeepReporter
};
});
</script>