blob: bb1b230876a8af1b380459eae42bbbe13d670fa1 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2013 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/utils.html">
<link rel="import" href="/base/event_target.html">
<link rel="import" href="/base/deep_utils.html">
<link rel="import" href="/core/selection_controller.html">
<link rel="import" href="/core/analysis/analysis_view.html">
<link rel="import" href="/extras/chrome/cc/raster_task_view.html">
<link rel="import" href="/extras/chrome/cc/raster_task_selection.html">
<link rel="import" href="/extras/chrome/cc/layer_tree_host_impl_view.html">
<link rel="import" href="/extras/importer/trace_event_importer.html">
<link rel="import" href="/model/model.html">
<script src="/extras/chrome/cc/layer_tree_host_impl_test_data.js"></script>
<script>
'use strict';
tr.b.unittest.testSuite(function() {
function createSelection() {
var m = new tr.Model(g_catLTHIEvents);
var p = m.processes[1];
var rasterTasks = p.threads[1].sliceGroup.slices.filter(function(slice) {
return slice.title == 'RasterTask' || slice.title == 'AnalyzeTask';
});
var selection = new tr.c.Selection();
selection.model = m;
selection.push(rasterTasks[0]);
selection.push(rasterTasks[1]);
return selection;
}
test('basic', function() {
var selection = createSelection();
var view = new RasterTaskView();
view.selection = selection;
this.addHTMLOutput(view);
});
test('analysisViewIntegration', function() {
var selection = createSelection();
var timelineView = {model: selection.model};
var selectionController = new tr.c.SelectionController(timelineView);
var analysisEl = document.createElement('tr-c-a-analysis-view');
analysisEl.selectionController = selectionController;
selectionController.changeSelectionFromTimeline(selection);
assert.isDefined(analysisEl.querySelector('RasterTaskView'));
var sv = tr.b.findDeepElementMatching(
analysisEl, 'tr-c-a-multi-thread-slice-sub-view');
assert.isTrue(sv.requiresTallView);
this.addHTMLOutput(analysisEl);
});
});
</script>