3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
8 <link rel="import" href="/cc/picture_ops_list_view.html">
9 <link rel="import" href="/cc/picture.html">
10 <link rel="import" href="/tracing/importer/trace_event_importer.html">
11 <link rel="import" href="/tracing/trace_model.html">
13 <script src="/cc/layer_tree_host_impl_test_data.js"></script>
18 tvcm.unittest.testSuite(function() {
19 var PictureOpsListView = cc.PictureOpsListView;
21 test('instantiate', function() {
22 if (!cc.PictureSnapshot.CanRasterize())
24 var m = new tracing.TraceModel(g_catLTHIEvents);
25 var p = tvcm.dictionaryValues(m.processes)[0];
27 var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
28 var snapshot = instance.snapshots[0];
30 var view = new PictureOpsListView();
31 view.picture = snapshot;
32 assertEquals(140, view.opsList_.children.length);
35 test('selection', function() {
36 if (!cc.PictureSnapshot.CanRasterize())
38 var m = new tracing.TraceModel(g_catLTHIEvents);
39 var p = tvcm.dictionaryValues(m.processes)[0];
41 var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
42 var snapshot = instance.snapshots[0];
44 var view = new PictureOpsListView();
45 view.picture = snapshot;
46 var didSelectionChange = 0;
47 view.addEventListener('selection-changed', function() {
48 didSelectionChange = true;
50 assertFalse(didSelectionChange);
51 view.opsList_.selectedElement = view.opsList_.children[3];
52 assertTrue(didSelectionChange);