| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Copyright 2016 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="/tracing/core/test_utils.html"> |
| 9 <link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html
"> |
| 10 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> |
| 11 <link rel="import" href="/tracing/model/model.html"> |
| 12 <link rel="import" href="/tracing/model/scoped_id.html"> |
| 13 |
| 14 <script> |
| 15 'use strict'; |
| 16 |
| 17 tr.b.unittest.testSuite(function() { |
| 18 var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot; |
| 19 var BlameContextInstance = tr.e.chrome.BlameContextInstance; |
| 20 |
| 21 function TestBlameContextSnapshot() { |
| 22 BlameContextSnapshot.apply(this, arguments); |
| 23 } |
| 24 |
| 25 TestBlameContextSnapshot.prototype = { |
| 26 __proto__: BlameContextSnapshot.prototype, |
| 27 |
| 28 get userFriendlyName() { |
| 29 return 'Test'; |
| 30 } |
| 31 }; |
| 32 |
| 33 tr.model.ObjectSnapshot.register( |
| 34 TestBlameContextSnapshot, |
| 35 {typeName: 'Test'}); |
| 36 |
| 37 function TestBlameContextInstance() { |
| 38 BlameContextInstance.apply(this, arguments); |
| 39 } |
| 40 |
| 41 TestBlameContextInstance.prototype = { |
| 42 __proto__: BlameContextInstance.prototype, |
| 43 |
| 44 get isTracedByRenderer() { |
| 45 return false; |
| 46 }, |
| 47 |
| 48 get blameContextType() { |
| 49 return 'Test'; |
| 50 } |
| 51 }; |
| 52 |
| 53 tr.model.ObjectInstance.register( |
| 54 TestBlameContextInstance, |
| 55 {typeName: 'Test'}); |
| 56 |
| 57 test('parentContext', function() { |
| 58 var model = new tr.Model(); |
| 59 var process = model.getOrCreateProcess(1); |
| 60 var parent = process.objects.addSnapshot( |
| 61 new tr.model.ScopedId('Test', '0x1'), |
| 62 'cat', 'Test', 1000, {}); |
| 63 var child = process.objects.addSnapshot( |
| 64 new tr.model.ScopedId('Test', '0x2'), |
| 65 'cat', 'Test', 1111, { |
| 66 parent: { |
| 67 scope: 'Test', |
| 68 id_ref: '0x1' |
| 69 } |
| 70 }); |
| 71 model.joinRefs(); |
| 72 assert.isTrue(child.parentContext === parent); |
| 73 }); |
| 74 }); |
| 75 </script> |
| OLD | NEW |