Chromium Code Reviews| Index: tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html |
| diff --git a/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html b/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c60d1cf684b2c4c06fc5cdf668dd27e378d8a080 |
| --- /dev/null |
| +++ b/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<!-- |
| +Copyright 2016 The Chromium Authors. All rights reserved. |
| +Use of this source code is governed by a BSD-style license that can be |
| +found in the LICENSE file. |
| +--> |
| + |
| +<link rel="import" href="/tracing/extras/chrome/blame_context/frame_tree_node.html"> |
| +<link rel="import" href="/tracing/extras/chrome/blame_context/render_frame.html"> |
| +<link rel="import" href="/tracing/extras/chrome/blame_context/top_level.html"> |
| +<link rel="import" href="/tracing/model/model.html"> |
| +<link rel="import" href="/tracing/model/scoped_id.html"> |
| + |
| +<script> |
| +'use strict'; |
| + |
| +tr.b.unittest.testSuite(function() { |
| + test('crossProcessCounterpart', function() { |
| + var model = new tr.Model(); |
| + var browser = model.getOrCreateProcess(1); |
| + var frameTreeNode = browser.objects.addSnapshot( |
| + new tr.model.ScopedId('FrameTreeNode', '0x1'), |
| + 'navigation', 'FrameTreeNode', 1111, { |
| + renderFrame: { |
| + scope: 'RenderFrame', |
| + id_ref: '0x3', |
| + pid_ref: 2 |
| + } |
| + }); |
| + var renderer = model.getOrCreateProcess(2); |
| + // Add a toplevel to make the context tree consistent with the spec, though |
| + // its functionality is not tested here. |
| + var topLevel = renderer.objects.addSnapshot( |
| + new tr.model.ScopedId('PlatformThread', '0x2'), |
| + 'blink', 'TopLevel', 1234, {}); |
| + var renderFrame = renderer.objects.addSnapshot( |
| + new tr.model.ScopedId('RenderFrame', '0x3'), |
| + 'blink', 'RenderFrame', 1357, { |
| + parent: { |
| + scope: 'PlatformThread', |
| + id_ref: '0x2' |
| + } |
| + }); |
| + model.joinRefs(); |
|
benjhayden
2016/06/01 20:48:24
Would it be possible to use TestUtils.newModel() a
Xiaocheng
2016/06/02 06:54:55
Done.
The test cases look much better now. Thanks
|
| + |
| + assert.isTrue(frameTreeNode.crossProcessCounterpart === renderFrame); |
| + assert.isTrue(renderFrame.crossProcessCounterpart === frameTreeNode); |
| + }); |
| +}); |
| +</script> |