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

Side by Side Diff: LayoutTests/resources/testharness-helpers.js

Issue 1295373003: Remove sequential_promise_test helper, just use promise_test (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove testharness-helpers.js inclusion from bluetooth tests Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/serviceworker/getregistrations.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * testharness-helpers contains various useful extensions to testharness.js to 2 * testharness-helpers contains various useful extensions to testharness.js to
3 * allow them to be used across multiple tests before they have been 3 * allow them to be used across multiple tests before they have been
4 * upstreamed. This file is intended to be usable from both document and worker 4 * upstreamed. This file is intended to be usable from both document and worker
5 * environments, so code should for example not rely on the DOM. 5 * environments, so code should for example not rely on the DOM.
6 */ 6 */
7 7
8 // Returns a promise that fulfills after the provided |promise| is fulfilled. 8 // Returns a promise that fulfills after the provided |promise| is fulfilled.
9 // The |test| succeeds only if |promise| rejects with an exception matching 9 // The |test| succeeds only if |promise| rejects with an exception matching
10 // |code|. Accepted values for |code| follow those accepted for assert_throws(). 10 // |code|. Accepted values for |code| follow those accepted for assert_throws().
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (typeof src != "object") 154 if (typeof src != "object")
155 return src; 155 return src;
156 var dst = Array.isArray(src) ? [] : {}; 156 var dst = Array.isArray(src) ? [] : {};
157 for (var property in src) { 157 for (var property in src) {
158 dst[property] = deepCopy(src[property]); 158 dst[property] = deepCopy(src[property]);
159 } 159 }
160 return dst; 160 return dst;
161 } 161 }
162 return JSON.stringify(deepCopy(object)); 162 return JSON.stringify(deepCopy(object));
163 } 163 }
164
165 (function() {
166 var promise_tests = Promise.resolve();
167 // Helper function to run promise tests one after the other.
168 // TODO(ortuno): Remove once https://github.com/w3c/testharness.js/pull/115/fi les
169 // gets through.
170 function sequential_promise_test(func, name) {
171 var test = async_test(name);
172 promise_tests = promise_tests.then(function() {
173 return test.step(func, test, test);
174 }).then(function() {
175 test.done();
176 }).catch(test.step_func(function(value) {
177 // step_func catches the error again so the error doesn't propagate.
178 throw value;
179 }));
180 }
181
182 self.sequential_promise_test = sequential_promise_test;
183 })();
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/getregistrations.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698