<!DOCTYPE html>
<!--
Copyright 2016 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="/tracing/model/event_set.html">
<link rel="import" href="/tracing/model/model.html">
<link rel="import" href="/tracing/model/power_sample.html">
<link rel="import" href="/tracing/model/power_series.html">
<link rel="import" href="/tracing/ui/analysis/frame_power_usage_chart.html">

<script>
'use strict';

tr.b.unittest.testSuite(function() {

  function instantiateManyFrames() {
    var model = new tr.Model();
    var numFrames = 200;
    var samplesPerFrame = 200;

    // Set up the test data.
    var series = new tr.model.PowerSeries(model.device);
    var vsyncTimestamps = [];
    for (var i = 0; i < numFrames; i++) {
      vsyncTimestamps.push(i * samplesPerFrame);
      for (var j = 0; j < samplesPerFrame; j++)
        series.addPowerSample(vsyncTimestamps[i] + j, j);
    }
    var samples = series.samples;

    // Display the chart.
    var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
    chart.setData(new tr.model.EventSet(samples), vsyncTimestamps);
    this.addHTMLOutput(chart);
  }

  timedPerfTest('frame_power_usage_chart', instantiateManyFrames, {
      iterations: 1
    });
});
</script>

Add performance test for power usage chart.
Add performance test for power usage chart.

Add performance test for power usage chart that tests creating a chart
with many samples.

BUG=catapult:#2300

Review-Url: https://codereview.chromium.org/1946383002
