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

Unified Diff: tracing/tracing/extras/chrome/blame_context/blame_context_test.html

Issue 2016213002: Introduce base classes for blame contexts (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Remove FrameBlameContextBase; Switch back to manual model setup in test; Some other revisions Created 4 years, 7 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
Index: tracing/tracing/extras/chrome/blame_context/blame_context_test.html
diff --git a/tracing/tracing/extras/chrome/blame_context/blame_context_test.html b/tracing/tracing/extras/chrome/blame_context/blame_context_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..0767958d59404a33d2da9156a5746d0e914ea2a2
--- /dev/null
+++ b/tracing/tracing/extras/chrome/blame_context/blame_context_test.html
@@ -0,0 +1,75 @@
+<!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/extras/chrome/blame_context/blame_context.html">
+<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
+<link rel="import" href="/tracing/model/model.html">
+<link rel="import" href="/tracing/model/scoped_id.html">
+
+<script>
+'use strict';
+
+tr.b.unittest.testSuite(function() {
+ var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
+ var BlameContextInstance = tr.e.chrome.BlameContextInstance;
+
+ function TestBlameContextSnapshot() {
+ BlameContextSnapshot.apply(this, arguments);
+ }
+
+ TestBlameContextSnapshot.prototype = {
+ __proto__: BlameContextSnapshot.prototype,
+
+ get userFriendlyName() {
+ return 'Test';
+ }
+ };
+
+ tr.model.ObjectSnapshot.register(
+ TestBlameContextSnapshot,
+ {typeName: 'Test'});
+
+ function TestBlameContextInstance() {
+ BlameContextInstance.apply(this, arguments);
+ }
+
+ TestBlameContextInstance.prototype = {
+ __proto__: BlameContextInstance.prototype,
+
+ get isTracedByRenderer() {
+ return false;
+ },
+
+ get blameContextType() {
+ return 'Test';
+ }
+ };
+
+ tr.model.ObjectInstance.register(
+ TestBlameContextInstance,
+ {typeName: 'Test'});
+
+ test('parentContext', function() {
+ var model = new tr.Model();
+ var process = model.getOrCreateProcess(1);
+ var parent = process.objects.addSnapshot(
+ new tr.model.ScopedId('Test', '0x1'),
+ 'cat', 'Test', 1000, {});
+ var child = process.objects.addSnapshot(
+ new tr.model.ScopedId('Test', '0x2'),
+ 'cat', 'Test', 1111, {
+ parent: {
+ scope: 'Test',
+ id_ref: '0x1'
+ }
+ });
+ model.joinRefs();
+ assert.isTrue(child.parentContext === parent);
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698