blob: c1eb31070c6fd4f65e17dce9beabaed0f1f79939 [file] [log] [blame]
<!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/model/event_set.html">
<link rel="import"
href="/tracing/extras/chrome/chrome_user_friendly_category_driver.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.allocate(),
title: 'FrameView::layout',
category: 'cat'
}), 'layout');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'Script',
category: 'cat'
}), 'script');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'Paint',
category: 'cat'
}), 'record');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'Document::updateStyle',
category: 'cat'
}), 'style');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser',
category: 'cat'
}), 'parseHTML');
});
test('ufcFromTraceCategory', function() {
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'a',
category: 'netlog'
}), 'net');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'a',
category: 'foobar,overhead'
}), 'overhead');
assert.equal(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'a',
category: 'startup'
}), 'startup');
});
test('ufcUndefined', function() {
assert.isUndefined(ufcFromEvent({
guid: tr.b.GUID.allocate(),
title: 'a',
category: 'other'
}));
});
});
</script>