OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 "userscripts/another-test.html": { | 117 "userscripts/another-test.html": { |
118 "Mock Builder": { | 118 "Mock Builder": { |
119 "expected": "PASS", | 119 "expected": "PASS", |
120 "actual": "TEXT" | 120 "actual": "TEXT" |
121 } | 121 } |
122 } | 122 } |
123 }; | 123 }; |
124 | 124 |
125 test('View', 18, function() { | 125 test('View', 18, function() { |
126 var delegate = { | 126 var delegate = { |
127 fetchResultsURLs: function(failureInfo, callback) { return; } | 127 fetchResultsURLs: function(failureInfo) { return Promise.resolve(); } |
128 }; | 128 }; |
129 | 129 |
130 var view = new ui.results.View(delegate); | 130 var view = new ui.results.View(delegate); |
131 view.setResultsByTest(kExampleResultsByTest); | 131 view.setResultsByTest(kExampleResultsByTest); |
132 | 132 |
133 view.firstResult(); | 133 view.firstResult(); |
134 var testSelector = view.querySelector('.test-selector'); | 134 var testSelector = view.querySelector('.test-selector'); |
135 var topPanel = testSelector.querySelector('.top-panel'); | 135 var topPanel = testSelector.querySelector('.top-panel'); |
136 equals(topPanel.childNodes[0], topPanel.querySelector('.active'));; | 136 equals(topPanel.childNodes[0], topPanel.querySelector('.active'));; |
137 equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 0); | 137 equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 0); |
(...skipping 21 matching lines...) Expand all Loading... |
159 equals(topPanel.childNodes[0], topPanel.querySelector('.active'));; | 159 equals(topPanel.childNodes[0], topPanel.querySelector('.active'));; |
160 equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1); | 160 equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1); |
161 equals(view.currentTestName(), 'scrollbars/custom-scrollbar-with-incomplete-
style.html'); | 161 equals(view.currentTestName(), 'scrollbars/custom-scrollbar-with-incomplete-
style.html'); |
162 | 162 |
163 ok(!testSelector.querySelector('.resize-handle')); | 163 ok(!testSelector.querySelector('.resize-handle')); |
164 equals(topPanel.style.minHeight, ''); | 164 equals(topPanel.style.minHeight, ''); |
165 }); | 165 }); |
166 | 166 |
167 test('View with more than four tests', 2, function() { | 167 test('View with more than four tests', 2, function() { |
168 var delegate = { | 168 var delegate = { |
169 fetchResultsURLs: function(failureInfo, callback) { return; } | 169 fetchResultsURLs: function(failureInfo) { return Promise.resolve(); } |
170 }; | 170 }; |
171 | 171 |
172 var view = new ui.results.View(delegate); | 172 var view = new ui.results.View(delegate); |
173 view.setResultsByTest(kExampleGreaterThanFourResultsByTest); | 173 view.setResultsByTest(kExampleGreaterThanFourResultsByTest); |
174 | 174 |
175 var testSelector = view.querySelector('.test-selector'); | 175 var testSelector = view.querySelector('.test-selector'); |
176 var topPanel = testSelector.querySelector('.top-panel'); | 176 var topPanel = testSelector.querySelector('.top-panel'); |
177 | 177 |
178 ok(testSelector.querySelector('.resize-handle')); | 178 ok(testSelector.querySelector('.resize-handle')); |
179 equals(topPanel.style.minHeight, '100px'); | 179 equals(topPanel.style.minHeight, '100px'); |
180 }); | 180 }); |
181 | 181 |
182 test('View with reftests', 2, function() { | 182 test('View with reftests', 2, function() { |
183 var delegate = { | 183 var delegate = { |
184 fetchResultsURLs: function(failureInfo, callback) { return; } | 184 fetchResultsURLs: function(failureInfo) { return Promise.resolve(); } |
185 }; | 185 }; |
186 | 186 |
187 var view = new ui.results.View(delegate); | 187 var view = new ui.results.View(delegate); |
188 view.setResultsByTest(kExampleReftestResults); | 188 view.setResultsByTest(kExampleReftestResults); |
189 view.firstResult(); | 189 view.firstResult(); |
190 | 190 |
191 equals($('.non-action-button', view).length, 1); | 191 equals($('.non-action-button', view).length, 1); |
192 equals($('.action', view).length, 0); | 192 equals($('.action', view).length, 0); |
193 }); | 193 }); |
194 | 194 |
195 test('View of timeouts', 1, function() { | 195 asyncTest('View of timeouts', 1, function() { |
| 196 var emptyPromise = Promise.resolve([]); |
196 var delegate = { | 197 var delegate = { |
197 fetchResultsURLs: function(failureInfo, callback) { callback([]); } | 198 fetchResultsURLs: function(failureInfo) { return emptyPromise; } |
198 }; | 199 }; |
199 | 200 |
200 var view = new ui.results.View(delegate); | 201 var view = new ui.results.View(delegate); |
201 view.setResultsByTest(kExampleResultsWithTimeoutByTest); | 202 view.setResultsByTest(kExampleResultsWithTimeoutByTest); |
202 view.firstResult(); | 203 view.firstResult(); |
203 | 204 emptyPromise.then(function() { |
204 equals($('.results-grid', view).html(), 'No results to display.'); | 205 equals($('.results-grid', view).html(), 'No results to display.'); |
| 206 start(); |
| 207 }); |
205 }); | 208 }); |
206 | 209 |
207 })(); | 210 })(); |
OLD | NEW |