blob: 2f632e1432b0e34933cb42a3d8eaec088210f8aa [file] [log] [blame]
Chris Craik44c28202015-05-12 17:25:16 -07001<!DOCTYPE html>
2<!--
3Copyright (c) 2013 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/core/analysis/analysis_view.html">
9<link rel="import" href="/core/test_utils.html">
10<link rel="import" href="/core/selection.html">
11<link rel="import" href="/core/trace_model/trace_model.html">
12
13<script>
14'use strict';
15
16tv.b.unittest.testSuite(function() {
17 var TraceModel = tv.c.TraceModel;
18 var Selection = tv.c.Selection;
19 var GlobalMemoryDump = tv.c.trace_model.GlobalMemoryDump;
20 var ProcessMemoryDump = tv.c.trace_model.ProcessMemoryDump;
21
22 test('basic', function() {
23 var m = new TraceModel();
24 var p = m.getOrCreateProcess(42);
25
26 function addProcessMemoryDump(timestamp) {
27 var gmd = new GlobalMemoryDump(m, timestamp);
28 m.globalMemoryDumps.push(gmd);
29 var pmd = new ProcessMemoryDump(gmd, p, timestamp);
30 p.memoryDumps.push(pmd);
31 gmd.processMemoryDumps[pmd.pid] = pmd;
32 return pmd;
33 }
34
35 var d1 = addProcessMemoryDump(5);
36 var d2 = addProcessMemoryDump(20);
37
38 var selection = new Selection();
39 selection.push(d1);
40 selection.push(d2);
41 assert.equal(selection.length, 2);
42
43 var subView = document.createElement(
44 'tv-c-multi-process-memory-dump-sub-view');
45 subView.selection = selection;
46
47 this.addHTMLOutput(subView);
48 });
49});
50</script>