diff options
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html')
-rw-r--r-- | chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html deleted file mode 100644 index 29997361918..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html +++ /dev/null @@ -1,122 +0,0 @@ -<!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='/tracing/model/device.html'> -<link rel='import' href='/tracing/model/model.html'> -<link rel='import' href='/tracing/model/power_series.html'> -<link rel='import' href='/tracing/ui/base/constants.html'> -<link rel='import' href='/tracing/ui/timeline_viewport.html'> -<link rel='import' href='/tracing/ui/tracks/container_to_track_map.html'> -<link rel='import' href='/tracing/ui/tracks/drawing_container.html'> -<link rel="import" href="/tracing/ui/tracks/power_series_track.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - - var Device = tr.model.Device; - var Model = tr.Model; - var PowerSeries = tr.model.PowerSeries; - var PowerSeriesTrack = tr.ui.tracks.PowerSeriesTrack; - - var createDrawingContainer = function(series) { - var div = document.createElement('div'); - var viewport = new tr.ui.TimelineViewport(div); - var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport); - div.appendChild(drawingContainer); - - if (series) { - series.updateBounds(); - setDisplayTransformFromBounds(viewport, series.bounds); - } - - return drawingContainer; - }; - - /** - * Sets the mapping between the input range of timestamps and the output range - * of horizontal pixels. - */ - var setDisplayTransformFromBounds = function(viewport, bounds) { - var dt = new tr.ui.TimelineDisplayTransform(); - var pixelRatio = window.devicePixelRatio || 1; - var chartPixelWidth = - (window.innerWidth - tr.ui.b.constants.HEADING_WIDTH) * pixelRatio; - dt.xSetWorldBounds(bounds.min, bounds.max, chartPixelWidth); - viewport.setDisplayTransformImmediately(dt); - }; - - test('instantiate', function() { - var series = new PowerSeries(new Model().device); - series.addPowerSample(0, 1); - series.addPowerSample(0.5, 2); - series.addPowerSample(1, 3); - series.addPowerSample(1.5, 4); - - var drawingContainer = createDrawingContainer(series); - var track = new PowerSeriesTrack(drawingContainer.viewport); - track.powerSeries = series; - drawingContainer.appendChild(track); - - this.addHTMLOutput(drawingContainer); - }); - - test('hasVisibleContent_trueWithPowerSamplesPresent', function() { - var series = new PowerSeries(new Model().device); - series.addPowerSample(0, 1); - series.addPowerSample(0.5, 2); - series.addPowerSample(1, 3); - series.addPowerSample(1.5, 4); - - var div = document.createElement('div'); - var viewport = new tr.ui.TimelineViewport(div); - - var track = new PowerSeriesTrack(viewport); - track.powerSeries = series; - - assert.isTrue(track.hasVisibleContent); - }); - - test('hasVisibleContent_falseWithUndefinedPowerSeries', function() { - var div = document.createElement('div'); - var viewport = new tr.ui.TimelineViewport(div); - - var track = new PowerSeriesTrack(viewport); - track.powerSeries = undefined; - - assert.notOk(track.hasVisibleContent); - }); - - test('hasVisibleContent_falseWithEmptyPowerSeries', function() { - var div = document.createElement('div'); - var viewport = new tr.ui.TimelineViewport(div); - - var track = new PowerSeriesTrack(viewport); - var series = new PowerSeries(new Model().device); - track.powerSeries = series; - - assert.notOk(track.hasVisibleContent); - }); - - test('addContainersToTrackMap', function() { - var div = document.createElement('div'); - var viewport = new tr.ui.TimelineViewport(div); - - var powerSeriesTrack = new PowerSeriesTrack(viewport); - var series = new PowerSeries(new Model().device); - powerSeriesTrack.powerSeries = series; - - var containerToTrackMap = new tr.ui.tracks.ContainerToTrackMap(); - powerSeriesTrack.addContainersToTrackMap(containerToTrackMap); - - assert.equal( - containerToTrackMap.getTrackByStableId('Device.PowerSeries'), - powerSeriesTrack); - }); -}); -</script> |