OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
3 Copyright 2015 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/mappers/scheduling/map_input_blockers.ht
ml"> | |
9 <link rel="import" href="/perf_insights/mre/mre_result.html"> | |
10 <link rel="import" href="/tracing/base/iteration_helpers.html"> | |
11 <link rel="import" href="/tracing/core/test_utils.html"> | |
12 <link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html"> | |
13 | |
14 <script> | |
15 'use strict'; | |
16 | |
17 tr.b.unittest.testSuite(function() { | |
18 var TestUtils = tr.c.TestUtils; | |
19 var ThreadSlice = tr.model.ThreadSlice; | |
20 | |
21 test('mapperTest', function() { | |
22 var m = tr.e.chrome.ChromeTestUtils.newChromeModel(function(m) { | |
23 var mainThread = m.rendererMain; | |
24 | |
25 // Set up a model with two events that are blocking input event handling. | |
26 mainThread.sliceGroup.pushSlice(TestUtils.newSliceEx({ | |
27 type: ThreadSlice, | |
28 start: -10, | |
29 duration: 15, | |
30 title: 'blockingEvent1' | |
31 })); | |
32 | |
33 mainThread.sliceGroup.pushSlice(TestUtils.newSliceEx({ | |
34 type: ThreadSlice, | |
35 start: 5, | |
36 duration: 4, | |
37 title: 'blockingEvent2' | |
38 })); | |
39 | |
40 var inputEvent = mainThread.sliceGroup.pushSlice(TestUtils.newSliceEx({ | |
41 type: ThreadSlice, | |
42 start: 10, | |
43 duration: 10, | |
44 title: 'LatencyInfo.Flow', | |
45 args: {step: 'HandleInputEventMain'} | |
46 })); | |
47 | |
48 var flow = TestUtils.newFlowEventEx({ | |
49 start: 0, | |
50 duration: 10 | |
51 }); | |
52 inputEvent.inFlowEvents.push(flow); | |
53 }); | |
54 | |
55 var result = new pi.mre.MreResult(); | |
56 pie.mapInputBlockersForTest(result, m); | |
57 | |
58 assert.equal(tr.b.dictionaryLength(result.pairs), 1); | |
59 | |
60 // The mapper computes the amount of delay each blocking event contributed | |
61 // to the input event. | |
62 var inputBlockers = result.pairs.inputBlockers; | |
63 assert.deepEqual(inputBlockers.blockingEvent1, [5]); | |
64 assert.deepEqual(inputBlockers.blockingEvent2, [4]); | |
65 }); | |
66 }); | |
67 | |
68 </script> | |
OLD | NEW |