| Index: third_party/WebKit/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js b/third_party/WebKit/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
|
| index fafa39d4fbdf095c2f2c114d9a3a7c4e3b3f2c05..a25c55868498cf8f0fb3fa4aa4200f818d5100e8 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js
|
| @@ -152,68 +152,48 @@ function size(headers) {
|
| }
|
|
|
| function testBlockMixedContent(mode) {
|
| - promise_test(function(t) {
|
| - return Promise.resolve()
|
| - .then(function() {
|
| - // Test 1: Must fail: blocked as mixed content.
|
| - return fetch(BASE_URL + 'test1-' + mode, {mode: mode})
|
| - .then(t.unreached_func('Test 1: Must be blocked (' +
|
| - mode + ', HTTPS->HTTP)'),
|
| - function() {});
|
| - })
|
| - .then(function() {
|
| - // Block mixed content in redirects.
|
| - // Test 2: Must fail: original fetch is not blocked but
|
| - // redirect is blocked.
|
| - return fetch(HTTPS_REDIRECT_URL +
|
| - encodeURIComponent(BASE_URL + 'test2-' + mode),
|
| - {mode: mode})
|
| - .then(t.unreached_func('Test 2: Must be blocked (' +
|
| - mode + ', HTTPS->HTTPS->HTTP)'),
|
| - function() {});
|
| - })
|
| - .then(function() {
|
| - // Test 3: Must fail: original fetch is blocked.
|
| - return fetch(REDIRECT_URL +
|
| - encodeURIComponent(HTTPS_BASE_URL + 'test3-' + mode),
|
| - {mode: mode})
|
| - .then(t.unreached_func('Test 3: Must be blocked (' +
|
| - mode + ', HTTPS->HTTP->HTTPS)'),
|
| - function() {});
|
| - })
|
| - .then(function() {
|
| - // Test 4: Must success.
|
| - // Test that the mixed contents above are not rejected due to
|
| - return fetch(HTTPS_REDIRECT_URL +
|
| - encodeURIComponent(HTTPS_BASE_URL + 'test4-' + mode),
|
| - {mode: mode})
|
| - .then(function(res) {assert_equals(res.status, mode == 'no-cors' ? 0 : 200); },
|
| - t.unreached_func('Test 4: Must success (' +
|
| - mode + ', HTTPS->HTTPS->HTTPS)'));
|
| - })
|
| - .then(function() {
|
| - // Test 5: Must success if mode is not 'same-origin'.
|
| - // Test that the mixed contents above are not rejected due to
|
| - // CORS check.
|
| - return fetch(HTTPS_OTHER_REDIRECT_URL +
|
| - encodeURIComponent(HTTPS_BASE_URL + 'test5-' + mode),
|
| - {mode: mode})
|
| - .then(function(res) {
|
| - if (mode === 'same-origin') {
|
| - assert_unreached(
|
| - 'Test 5: Cross-origin HTTPS request must fail: ' +
|
| - 'mode = ' + mode);
|
| - }
|
| - },
|
| - function() {
|
| - if (mode !== 'same-origin') {
|
| - assert_unreached(
|
| - 'Test 5: Cross-origin HTTPS request must success: ' +
|
| - 'mode = ' + mode);
|
| - }
|
| - });
|
| + promise_test(t => {
|
| + // Must fail: blocked as mixed content.
|
| + return fetch(BASE_URL + 'test1-' + mode, {mode: mode})
|
| + .then(unreached_fulfillment(t), () => {});
|
| + }, `Mixed content fetch (${mode}, HTTPS->HTTP)`);
|
| +
|
| + promise_test(t => {
|
| + // Must fail: original fetch is not blocked but redirect is blocked.
|
| + return fetch(HTTPS_REDIRECT_URL +
|
| + encodeURIComponent(BASE_URL + 'test2-' + mode), {mode: mode})
|
| + .then(unreached_fulfillment(t), () => {});
|
| + }, `Mixed content redirect (${mode}, HTTPS->HTTPS->HTTP)`);
|
| +
|
| + promise_test(t => {
|
| + // Must fail: original fetch is blocked.
|
| + return fetch(REDIRECT_URL +
|
| + encodeURIComponent(HTTPS_BASE_URL + 'test3-' + mode),
|
| + {mode: mode}).then(unreached_fulfillment(t), () => {});
|
| + }, `Mixed content redirect ${mode}, HTTPS->HTTP->HTTPS)`);
|
| +
|
| + promise_test(() => {
|
| + // Must success.
|
| + // Test that the mixed contents above are not rejected due to CORS check.
|
| + return fetch(HTTPS_REDIRECT_URL +
|
| + encodeURIComponent(HTTPS_BASE_URL + 'test4-' + mode),
|
| + {mode: mode}).then(res => {
|
| + assert_equals(res.status, mode === 'no-cors' ? 0 : 200);
|
| + });
|
| + }, `Same origin redirect (${mode}, HTTPS->HTTPS->HTTPS)`);
|
| +
|
| + promise_test(() => {
|
| + // Must success if mode is not 'same-origin'.
|
| + // Test that the mixed contents above are not rejected due to CORS check.
|
| + return fetch(HTTPS_OTHER_REDIRECT_URL +
|
| + encodeURIComponent(HTTPS_BASE_URL + 'test5-' + mode),
|
| + {mode: mode})
|
| + .then(res => {
|
| + assert_not_equals(mode, 'same-origin');
|
| + }, () => {
|
| + assert_equals(mode, 'same-origin');
|
| });
|
| - }, 'Block fetch() as mixed content (' + mode + ')');
|
| + }, `Cross origin redirect (${mode}, HTTPS->HTTPS->HTTPS`);
|
| }
|
|
|
| function add_referrer_tests(tests, global) {
|
|
|