1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<!DOCTYPE html>
<!--
Copyright (c) 2014 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/base/guid.html">
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import"
href="/tracing/extras/chrome/chrome_user_friendly_category_driver.html">
<link rel="import" href="/tracing/model/event_set.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
var ufcFromEvent = tr.e.chrome.ChromeUserFriendlyCategoryDriver.fromEvent;
test('userFriendlyCategory', function() {
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'FrameView::layout',
category: 'cat'
}), 'layout');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'V8.Execute',
category: 'cat'
}), 'script_execute');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'Paint',
category: 'cat'
}), 'record');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'Document::updateStyle',
category: 'cat'
}), 'style');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser',
category: 'cat'
}), 'parseHTML');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'constructor',
category: 'cat'
}), 'other');
});
test('ufcFromTraceCategory', function() {
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'a',
category: 'netlog'
}), 'net');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'a',
category: 'foobar,overhead'
}), 'overhead');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'a',
category: 'startup'
}), 'startup');
});
test('ufcOther', function() {
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocateSimple(),
title: 'a',
category: 'other'
}), 'other');
});
});
</script>
|