Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / cc / picture_ops_list_view_test.html
1 <!DOCTYPE html>
2 <!--
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.
6 -->
7
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">
12
13 <script src="/cc/layer_tree_host_impl_test_data.js"></script>
14
15 <script>
16 'use strict';
17
18 tv.unittest.testSuite(function() {
19   var PictureOpsListView = cc.PictureOpsListView;
20
21   test('instantiate', function() {
22     if (!cc.PictureSnapshot.CanRasterize())
23       return;
24     var m = new tracing.TraceModel(g_catLTHIEvents);
25     var p = tv.dictionaryValues(m.processes)[0];
26
27     var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
28     var snapshot = instance.snapshots[0];
29
30     var view = new PictureOpsListView();
31     view.picture = snapshot;
32     assertEquals(142, view.opsList_.children.length);
33   });
34
35   test('selection', function() {
36     if (!cc.PictureSnapshot.CanRasterize())
37       return;
38     var m = new tracing.TraceModel(g_catLTHIEvents);
39     var p = tv.dictionaryValues(m.processes)[0];
40
41     var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
42     var snapshot = instance.snapshots[0];
43
44     var view = new PictureOpsListView();
45     view.picture = snapshot;
46     var didSelectionChange = 0;
47     view.addEventListener('selection-changed', function() {
48       didSelectionChange = true;
49     });
50     assertFalse(didSelectionChange);
51     view.opsList_.selectedElement = view.opsList_.children[3];
52     assertTrue(didSelectionChange);
53   });
54
55 });
56 </script>