raster_task_view_test.html revision 4a4f2fe02baf385f6c24fc98c6e17bf6ac5e0724
1<!DOCTYPE html> 2<!-- 3Copyright (c) 2013 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/base/event_target.html"> 9<link rel="import" href="/tracing/base/utils.html"> 10<link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> 11<link rel="import" href="/tracing/model/event_set.html"> 12<link rel="import" href="/tracing/model/model.html"> 13<link rel="import" href="/tracing/ui/analysis/analysis_view.html"> 14<link rel="import" href="/tracing/ui/base/deep_utils.html"> 15<link rel="import" href="/tracing/ui/brushing_state_controller.html"> 16<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html"> 17<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_selection.html"> 18<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_view.html"> 19 20<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js"> 21</script> 22 23<script> 24'use strict'; 25 26tr.b.unittest.testSuite(function() { 27 function createSelection() { 28 var m = new tr.Model(g_catLTHIEvents); 29 var p = m.processes[1]; 30 var rasterTasks = p.threads[1].sliceGroup.slices.filter(function(slice) { 31 return slice.title == 'RasterTask' || slice.title == 'AnalyzeTask'; 32 }); 33 34 var selection = new tr.model.EventSet(); 35 selection.model = m; 36 37 selection.push(rasterTasks[0]); 38 selection.push(rasterTasks[1]); 39 return selection; 40 } 41 42 test('basic', function() { 43 var selection = createSelection(); 44 var view = document.createElement('tr-ui-e-chrome-cc-raster-task-view'); 45 view.selection = selection; 46 this.addHTMLOutput(view); 47 }); 48 49 test('analysisViewIntegration', function() { 50 var selection = createSelection(); 51 52 var timelineView = {model: selection.model}; 53 var brushingStateController = 54 new tr.c.BrushingStateController(timelineView); 55 56 var analysisEl = document.createElement('tr-ui-a-analysis-view'); 57 analysisEl.brushingStateController = brushingStateController; 58 brushingStateController.changeSelectionFromTimeline(selection); 59 60 assert.isDefined(analysisEl.querySelector( 61 'tr-ui-e-chrome-cc-raster-task-view')); 62 63 var sv = tr.b.findDeepElementMatching( 64 analysisEl, 'tr-ui-a-multi-thread-slice-sub-view'); 65 assert.isTrue(sv.requiresTallView); 66 this.addHTMLOutput(analysisEl); 67 }); 68}); 69</script> 70