Home | History | Annotate | Download | only in cc
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 'use strict';
      6 
      7 base.require('cc');
      8 base.require('cc.picture');
      9 base.require('cc.layer_tree_host_impl_test_data');
     10 base.require('tracing.importer.trace_event_importer');
     11 base.require('tracing.trace_model');
     12 
     13 base.unittest.testSuite('cc.picture', function() {
     14   test('basic', function() {
     15     var m = new tracing.TraceModel(g_catLTHIEvents);
     16     var p = base.dictionaryValues(m.processes)[0];
     17 
     18     var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
     19     var snapshot = instance.snapshots[0];
     20 
     21     assertTrue(snapshot instanceof cc.PictureSnapshot);
     22     instance.wasDeleted(150);
     23   });
     24 
     25   test('getOps', function() {
     26     var m = new tracing.TraceModel(g_catLTHIEvents);
     27     var p = base.dictionaryValues(m.processes)[0];
     28 
     29     var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
     30     var snapshot = instance.snapshots[0];
     31 
     32     var ops = snapshot.getOps();
     33     if (!ops)
     34       return;
     35     assertEquals(627, ops.length);
     36 
     37     var op0 = ops[0];
     38     assertEquals('Save', op0.cmd_string);
     39     assertTrue(op0.info instanceof Array);
     40   });
     41 });
     42