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

Unified Diff: LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js

Issue 1211623005: Unify multiple sequential_promise_test definitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update fetch templates and remove new duplicate of this method Created 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
diff --git a/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js b/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
index 43d46df2a2c4bfd3b5aacd552ee52beb325563ec..0a5f715e92dab38ef43260f60828437e49c99855 100644
--- a/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
+++ b/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
@@ -1,5 +1,6 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
+ importScripts('/resources/testharness-helpers.js');
importScripts('/serviceworker/resources/test-helpers.js');
importScripts('../resources/fetch-test-options.js');
}
@@ -13,47 +14,6 @@ function getContentType(headers) {
return content_type;
}
-
-(function () {
- var sequential_promise = Promise.resolve();
-
- // |sequential_test| is a dummy test to prevent tests from terminating early.
- // Without this, the number of pending tests recognized by testharness can
- // be zero, which leads to early unexpected test termination.
- var sequential_test = undefined;
-
- // sequential_promise_test() is similar to promise_test(), but multiple tests
- // are executed one by one sequentially.
- // Also call sequential_promise_test_done() after all
- // sequential_promise_test() are called.
- function sequential_promise_test(func, name) {
- if (sequential_test === undefined) {
- sequential_test = async_test('Sequential');
- }
- sequential_promise = sequential_promise
- .then(function() {
- var promise = undefined;
- promise_test(function(t) {
- promise = func(t);
- return promise;
- }, name);
- return promise;
- })
- .catch(function(e) {
- // The error was already reported. Continue to the next test.
- });
- }
-
- function sequential_promise_test_done() {
- if (sequential_test !== undefined) {
- sequential_promise.then(function() {sequential_test.done();});
- }
- }
-
- self.sequential_promise_test = sequential_promise_test;
- self.sequential_promise_test_done = sequential_promise_test_done;
-})();
-
// token [RFC 2616]
// "token = 1*<any CHAR except CTLs or separators>"
// All octets are tested except for those >= 0x80.

Powered by Google App Engine
This is Rietveld 408576698