OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
3 Copyright (c) 2013 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="/perf_insights/mre/mre_result.html"> | |
9 <link rel="import" href="/tracing/core/test_utils.html"> | |
10 <link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html"> | |
11 | |
12 <script> | |
13 'use strict'; | |
14 | |
15 tr.b.unittest.testSuite(function() { | |
16 var test_utils = tr.c.TestUtils; | |
17 test('basicChrome', function() { | |
18 var m = tr.e.chrome.ChromeTestUtils.newChromeModel(function(m) { | |
19 // Browser. | |
20 m.browserMain.sliceGroup.pushSlice(test_utils.newSliceEx({ | |
21 name: 'BrowserSlice', | |
22 start: 0, duration: 10 | |
23 })); | |
24 | |
25 // Renderer. | |
26 m.rendererMain.sliceGroup.pushSlice(test_utils.newSliceEx({ | |
27 name: 'RendererSlice', | |
28 start: 0, duration: 10 | |
29 })); | |
30 | |
31 // Something else else. | |
32 m.otherProcess = m.getOrCreateProcess(20); | |
33 m.otherProcessMain = m.otherProcess.getOrCreateThread(21); | |
34 m.otherProcessMain.sliceGroup.pushSlice(test_utils.newSliceEx({ | |
35 name: 'RendererSlice', | |
36 start: 0, duration: 10 | |
37 })); | |
38 }); | |
39 | |
40 var tg = new pi.m.ThreadGrouping(); | |
41 tg.autoInitUsingHelpers(m); | |
42 | |
43 var allSlices = new tr.model.EventSet(); | |
44 m.iterateAllEvents(function(e) { | |
45 if (e instanceof tr.model.Slice) | |
46 allSlices.push(e); | |
47 }); | |
48 var groups = tg.divideEventSetIntoSubGroups(allSlices); | |
49 var numGrouped = 0; | |
50 tr.b.iterItems(groups, function(groupName, eventSet) { | |
51 numGrouped += eventSet.length; | |
52 }); | |
53 assert.equal(numGrouped, allSlices.length); | |
54 assert.equal(groups.Browser.length, 1); | |
55 assert.equal(groups.Renderer.length, 1); | |
56 assert.equal(groups.Other.length, 1); | |
57 }); | |
58 }); | |
59 </script> | |
OLD | NEW |