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

Side by Side Diff: tracing/tracing/ui/analysis/analysis_view_test.html

Issue 2023283002: [polymer] Rewrite the analysis tab view (Closed) Base URL: git@github.com:zeptonaut/catapult.git@polymer10_rewrite_tab_view2
Patch Set: Code review 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 unified diff | Download patch
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/counter.html"> 9 <link rel="import" href="/tracing/model/counter.html">
10 <link rel="import" href="/tracing/model/counter_sample.html"> 10 <link rel="import" href="/tracing/model/counter_sample.html">
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 record2.associatedEvents.push(slice1); 67 record2.associatedEvents.push(slice1);
68 68
69 // Set up the analysis views and brushing state controller. 69 // Set up the analysis views and brushing state controller.
70 var analysisView = document.createElement('tr-ui-a-analysis-view'); 70 var analysisView = document.createElement('tr-ui-a-analysis-view');
71 this.addHTMLOutput(analysisView); 71 this.addHTMLOutput(analysisView);
72 var tabView = analysisView.tabView; 72 var tabView = analysisView.tabView;
73 var controller = new BrushingStateController(undefined); 73 var controller = new BrushingStateController(undefined);
74 analysisView.brushingStateController = controller; 74 analysisView.brushingStateController = controller;
75 75
76 function checkSelectedTab(expectedSelectedTab, expectedRelatedEvents) { 76 function checkSelectedTab(expectedSelectedTab, expectedRelatedEvents) {
77 assert.strictEqual(tabView.selectedTab, expectedSelectedTab); 77 assert.strictEqual(tabView.selectedSubView, expectedSelectedTab);
78 assertEventSet(controller.currentBrushingState.analysisViewRelatedEvents, 78 assertEventSet(controller.currentBrushingState.analysisViewRelatedEvents,
79 expectedRelatedEvents); 79 expectedRelatedEvents);
80 } 80 }
81 81
82 // 1. Empty selection (implicit). 82 // 1. Empty selection (implicit).
83 assert.lengthOf(tabView.tabs, 0); 83 assert.lengthOf(tabView.tabs, 0);
84 checkSelectedTab(undefined, []); 84 checkSelectedTab(undefined, []);
85 85
86 // 2. Event selection: two samples and one thread slice. 86 // 2. Event selection: two samples and one thread slice.
87 controller.changeSelectionFromRequestSelectionChangeEvent( 87 controller.changeSelectionFromRequestSelectionChangeEvent(
88 new EventSet([sample1, slice1, sample2])); 88 new EventSet([sample1, slice1, sample2]));
89 assert.lengthOf(tabView.tabs, 2); 89 assert.lengthOf(tabView.tabs, 2);
90 var sampleTab2 = tabView.tabs[0]; 90 var sampleTab2 = tabView.tabs[0];
91 checkTab(sampleTab2, 91 checkTab(sampleTab2,
92 'tr-ui-a-counter-sample-sub-view', 92 'tr-ui-a-counter-sample-sub-view',
93 [sample1, sample2]); 93 [sample1, sample2]);
94 var singleThreadSliceTab2 = tabView.tabs[1]; 94 var singleThreadSliceTab2 = tabView.tabs[1];
95 checkTab(singleThreadSliceTab2, 95 checkTab(singleThreadSliceTab2,
96 'tr-ui-a-single-thread-time-slice-sub-view', 96 'tr-ui-a-single-thread-time-slice-sub-view',
97 [slice1]); 97 [slice1]);
98 // First tab should be selected. 98 // First tab should be selected.
99 checkSelectedTab(sampleTab2, []); 99 checkSelectedTab(sampleTab2, []);
100 100
101 // 3. Tab selection: single thread slice tab. 101 // 3. Tab selection: single thread slice tab.
102 tabView.selectedTab = singleThreadSliceTab2; 102 tabView.selectedSubView = singleThreadSliceTab2;
103 checkSelectedTab(singleThreadSliceTab2, []); 103 checkSelectedTab(singleThreadSliceTab2, []);
104 104
105 // 4. Event selection: one sample, two thread slices, and one 105 // 4. Event selection: one sample, two thread slices, and one
106 // user expectation. 106 // user expectation.
107 controller.changeSelectionFromRequestSelectionChangeEvent( 107 controller.changeSelectionFromRequestSelectionChangeEvent(
108 new EventSet([slice1, slice2, sample3, record1])); 108 new EventSet([slice1, slice2, sample3, record1]));
109 assert.lengthOf(tabView.tabs, 3); 109 assert.lengthOf(tabView.tabs, 3);
110 var sampleTab4 = tabView.tabs[1]; 110 var sampleTab4 = tabView.tabs[1];
111 checkTab(sampleTab4, 111 checkTab(sampleTab4,
112 'tr-ui-a-counter-sample-sub-view', 112 'tr-ui-a-counter-sample-sub-view',
113 [sample3]); 113 [sample3]);
114 // Reuse tab (same event type and sub-view tag name).
115 assert.strictEqual(sampleTab4, sampleTab2);
116 var singleRecordTab4 = tabView.tabs[2]; 114 var singleRecordTab4 = tabView.tabs[2];
117 checkTab(singleRecordTab4, 115 checkTab(singleRecordTab4,
118 'tr-ui-a-single-user-expectation-sub-view', 116 'tr-ui-a-single-user-expectation-sub-view',
119 [record1]); 117 [record1]);
120 var multiThreadSliceTab4 = tabView.tabs[0]; 118 var multiThreadSliceTab4 = tabView.tabs[0];
121 checkTab(multiThreadSliceTab4, 119 checkTab(multiThreadSliceTab4,
122 'tr-ui-a-multi-thread-time-slice-sub-view', 120 'tr-ui-a-multi-thread-time-slice-sub-view',
123 [slice1, slice2]); 121 [slice1, slice2]);
124 // Remember selected tab (even though the tab was destroyed). 122 // Remember selected tab (even though the tab was destroyed).
125 checkSelectedTab(multiThreadSliceTab4, []); 123 checkSelectedTab(multiThreadSliceTab4, []);
126 124
127 // 5. Tab selection: single user expectation tab. 125 // 5. Tab selection: single user expectation tab.
128 tabView.selectedTab = singleRecordTab4; 126 tabView.selectedSubView = singleRecordTab4;
129 checkSelectedTab(singleRecordTab4, [sample1, slice1]); 127 checkSelectedTab(singleRecordTab4, [sample1, slice1]);
130 128
131 // 6. Event selection: one user expectation. 129 // 6. Event selection: one user expectation.
132 controller.changeSelectionFromRequestSelectionChangeEvent( 130 controller.changeSelectionFromRequestSelectionChangeEvent(
133 new EventSet([record2])); 131 new EventSet([record2]));
134 assert.lengthOf(tabView.tabs, 1); 132 assert.lengthOf(tabView.tabs, 1);
135 var singleRecordTab6 = tabView.tabs[0]; 133 var singleRecordTab6 = tabView.tabs[0];
136 checkTab(singleRecordTab6, 134 checkTab(singleRecordTab6,
137 'tr-ui-a-single-user-expectation-sub-view', 135 'tr-ui-a-single-user-expectation-sub-view',
138 [record2]); 136 [record2]);
139 // Reuse tab (same event type and sub-view tag name).
140 assert.strictEqual(singleRecordTab6, singleRecordTab4);
141 // Remember selected tab. 137 // Remember selected tab.
142 checkSelectedTab(singleRecordTab6, [sample2, sample3, slice1]); 138 checkSelectedTab(singleRecordTab6, [sample2, sample3, slice1]);
143 }); 139 });
144 }); 140 });
145 </script> 141 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698