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

Side by Side Diff: tracing/tracing/model/slice_test.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « tracing/tracing/model/slice_group.html ('k') | tracing/tracing/model/thread.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/core/test_utils.html"> 8 <link rel="import" href="/tracing/core/test_utils.html">
9 <link rel="import" href="/tracing/model/slice_group.html"> 9 <link rel="import" href="/tracing/model/slice_group.html">
10 10
(...skipping 29 matching lines...) Expand all
40 var group = new SliceGroup(newFakeThread()); 40 var group = new SliceGroup(newFakeThread());
41 41
42 var sC1 = group.pushSlice(newSliceEx( 42 var sC1 = group.pushSlice(newSliceEx(
43 { title: 'sC1', start: 0.0, duration: 10.0 })); 43 { title: 'sC1', start: 0.0, duration: 10.0 }));
44 var sC2 = group.pushSlice(newSliceEx( 44 var sC2 = group.pushSlice(newSliceEx(
45 { title: 'sC2', start: 0.0, duration: 4.0 })); 45 { title: 'sC2', start: 0.0, duration: 4.0 }));
46 46
47 group.createSubSlices(); 47 group.createSubSlices();
48 48
49 var foundSlices = []; 49 var foundSlices = [];
50 sC1.findTopmostSlicesRelativeToThisSlice(PREDICATE, slice => ( 50 for (var slice of sC1.findTopmostSlicesRelativeToThisSlice(PREDICATE))
51 foundSlices.push(slice)) 51 foundSlices.push(slice);
52 );
53 52
54 assert.deepEqual([sC1], foundSlices); 53 assert.deepEqual([sC1], foundSlices);
55 }); 54 });
56 55
57 test('findTopmostSlicesRelativeToThisSliceRecursive', function() { 56 test('findTopmostSlicesRelativeToThisSliceRecursive', function() {
58 var PREDICATE = slice => slice.title.startsWith('sC'); 57 var PREDICATE = slice => slice.title.startsWith('sC');
59 58
60 var group = new SliceGroup(newFakeThread()); 59 var group = new SliceGroup(newFakeThread());
61 60
62 var sD = group.pushSlice(newSliceEx( 61 var sD = group.pushSlice(newSliceEx(
63 { title: 'sD', start: 0.0, duration: 10.0 })); 62 { title: 'sD', start: 0.0, duration: 10.0 }));
64 var sC1 = group.pushSlice(newSliceEx( 63 var sC1 = group.pushSlice(newSliceEx(
65 { title: 'sC1', start: 0.0, duration: 4.0 })); 64 { title: 'sC1', start: 0.0, duration: 4.0 }));
66 var sC2 = group.pushSlice(newSliceEx( 65 var sC2 = group.pushSlice(newSliceEx(
67 { title: 'sC2', start: 6.0, duration: 3.0 })); 66 { title: 'sC2', start: 6.0, duration: 3.0 }));
68 67
69 group.createSubSlices(); 68 group.createSubSlices();
70 69
71 var foundSlices = []; 70 var foundSlices = [];
72 sD.findTopmostSlicesRelativeToThisSlice(PREDICATE, slice => ( 71 for (var slice of sD.findTopmostSlicesRelativeToThisSlice(PREDICATE))
73 foundSlices.push(slice))); 72 foundSlices.push(slice);
74
75 assert.deepEqual([sC1, sC2], foundSlices); 73 assert.deepEqual([sC1, sC2], foundSlices);
76 }); 74 });
77 75
78 test('iterateAllDescendents', function() { 76 test('enumerateAllDescendents', function() {
79 var group = new SliceGroup(newFakeThread()); 77 var group = new SliceGroup(newFakeThread());
80 78
81 var sA = group.pushSlice(newSliceEx( 79 var sA = group.pushSlice(newSliceEx(
82 { title: 'sA', start: 0.0, duration: 10.0 })); 80 { title: 'sA', start: 0.0, duration: 10.0 }));
83 var sB = group.pushSlice(newSliceEx( 81 var sB = group.pushSlice(newSliceEx(
84 { title: 'sB', start: 0.0, duration: 4.0 })); 82 { title: 'sB', start: 0.0, duration: 4.0 }));
85 var sC = group.pushSlice(newSliceEx( 83 var sC = group.pushSlice(newSliceEx(
86 { title: 'sC', start: 0.0, duration: 2.0 })); 84 { title: 'sC', start: 0.0, duration: 2.0 }));
87 85
88 group.createSubSlices(); 86 group.createSubSlices();
(...skipping 12 matching lines...) Expand all
101 var sC = group.pushSlice(newSliceEx( 99 var sC = group.pushSlice(newSliceEx(
102 { title: 'sC', start: 0.0, duration: 2.0 })); 100 { title: 'sC', start: 0.0, duration: 2.0 }));
103 101
104 group.createSubSlices(); 102 group.createSubSlices();
105 103
106 assert.equal(sA.mostTopLevelSlice, sA); 104 assert.equal(sA.mostTopLevelSlice, sA);
107 assert.equal(sB.mostTopLevelSlice, sA); 105 assert.equal(sB.mostTopLevelSlice, sA);
108 assert.equal(sC.mostTopLevelSlice, sA); 106 assert.equal(sC.mostTopLevelSlice, sA);
109 }); 107 });
110 108
111 test('iterateAllAncestors', function() { 109 test('enumerateAllAncestors', function() {
112 var group = new SliceGroup(newFakeThread()); 110 var group = new SliceGroup(newFakeThread());
113 111
114 var sA = group.pushSlice(newSliceEx( 112 var sA = group.pushSlice(newSliceEx(
115 { title: 'sA', start: 0.0, duration: 10.0 })); 113 { title: 'sA', start: 0.0, duration: 10.0 }));
116 var sB = group.pushSlice(newSliceEx( 114 var sB = group.pushSlice(newSliceEx(
117 { title: 'sB', start: 0.0, duration: 4.0 })); 115 { title: 'sB', start: 0.0, duration: 4.0 }));
118 var sC = group.pushSlice(newSliceEx( 116 var sC = group.pushSlice(newSliceEx(
119 { title: 'sC', start: 0.0, duration: 2.0 })); 117 { title: 'sC', start: 0.0, duration: 2.0 }));
120 118
121 group.createSubSlices(); 119 group.createSubSlices();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 { title: 'sB', start: 10.0, duration: 20.0 })); 210 { title: 'sB', start: 10.0, duration: 20.0 }));
213 var sC = group.pushSlice(newSliceEx( 211 var sC = group.pushSlice(newSliceEx(
214 { title: 'sC', start: 20.0, duration: 30.0 })); 212 { title: 'sC', start: 20.0, duration: 30.0 }));
215 213
216 assert.equal(group.stableId + '.0', sA.stableId); 214 assert.equal(group.stableId + '.0', sA.stableId);
217 assert.equal(group.stableId + '.1', sB.stableId); 215 assert.equal(group.stableId + '.1', sB.stableId);
218 assert.equal(group.stableId + '.2', sC.stableId); 216 assert.equal(group.stableId + '.2', sC.stableId);
219 }); 217 });
220 }); 218 });
221 </script> 219 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/model/slice_group.html ('k') | tracing/tracing/model/thread.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698