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('tracing.trace_model.object_instance'); 8 base.require('tracing.trace_model.object_snapshot'); 9 10 base.unittest.testSuite('tracing.trace_model.object_snapshot', function() { 11 test('snapshotTypeRegistry', function() { 12 function MySnapshot() { 13 tracing.trace_model.ObjectSnapshot.apply(this, arguments); 14 this.myFoo = this.args.foo; 15 } 16 17 MySnapshot.prototype = { 18 __proto__: tracing.trace_model.ObjectSnapshot.prototype 19 }; 20 21 var instance = new tracing.trace_model.ObjectInstance( 22 {}, '0x1000', 'cat', 'MySnapshot', 10); 23 try { 24 tracing.trace_model.ObjectSnapshot.register('MySnapshot', MySnapshot); 25 var snapshot = instance.addSnapshot(15, {foo: 'bar'}); 26 assertTrue(snapshot instanceof MySnapshot); 27 assertEquals('bar', snapshot.myFoo); 28 } finally { 29 tracing.trace_model.ObjectSnapshot.unregister('MySnapshot'); 30 } 31 }); 32 }); 33