Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: tracing/tracing/value/diagnostics/related_event_set_test.html

Issue 2046553003: Add RelatedEventSet Diagnostic (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: comments, rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/value/diagnostics/related_event_set.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/value/diagnostics/related_event_set_test.html
diff --git a/tracing/tracing/value/diagnostics/related_event_set_test.html b/tracing/tracing/value/diagnostics/related_event_set_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..de901b53e2d2380ada9d4f1fc0db411cc90d3d74
--- /dev/null
+++ b/tracing/tracing/value/diagnostics/related_event_set_test.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!--
+Copyright 2016 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/core/test_utils.html">
+<link rel="import" href="/tracing/value/diagnostics/related_event_set.html">
+
+<script>
+'use strict';
+
+tr.b.unittest.testSuite(function() {
+ test('eventSet', function() {
+ var slice = undefined;
+ var model = tr.c.TestUtils.newModel(function(model) {
+ slice = tr.c.TestUtils.newSliceEx({
+ type: tr.model.ThreadSlice,
+ title: 'foo',
+ start: 0,
+ duration: 10
+ });
+ var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
+ thread.sliceGroup.pushSlice(slice);
+ });
+
+ var d = new tr.v.d.RelatedEventSet(slice);
+ assert.lengthOf(d.events, 1);
+ assert.strictEqual(d.events[0], slice);
+
+ d = new tr.v.d.RelatedEventSet([slice]);
+ assert.lengthOf(d.events, 1);
+ assert.strictEqual(d.events[0], slice);
+
+ d = new tr.v.d.RelatedEventSet(new tr.model.EventSet([slice]));
+ assert.lengthOf(d.events, 1);
+ assert.strictEqual(d.events[0], slice);
+
+ var d2 = tr.v.d.Diagnostic.fromDict(d.asDict());
+ assert.instanceOf(d2, tr.v.d.RelatedEventSet);
+ assert.lengthOf(d2.events, 1);
+
+ // Can't use assert.instanceOf() because EventRef is private.
+ assert.isFalse(d2.events[0] instanceof tr.model.Event);
+
+ d2.resolve(model, true);
+
+ assert.strictEqual(d2.events[0], slice);
+ });
+});
+</script>
« no previous file with comments | « tracing/tracing/value/diagnostics/related_event_set.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698