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

Unified Diff: LayoutTests/http/tests/fetch/script-tests/block-mixed-content.js

Issue 921673003: [Fetch] Split layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/script-tests/block-mixed-content.js
diff --git a/LayoutTests/http/tests/fetch/script-tests/block-mixed-content.js b/LayoutTests/http/tests/fetch/script-tests/block-mixed-content.js
index bbe023b59fbd195c0552c368d473f8653d3fd701..40e1bdca059634b5a4d0c0e5a5dc8a357182eca1 100644
--- a/LayoutTests/http/tests/fetch/script-tests/block-mixed-content.js
+++ b/LayoutTests/http/tests/fetch/script-tests/block-mixed-content.js
@@ -17,69 +17,7 @@ var HTTPS_REDIRECT_URL =
var HTTPS_OTHER_REDIRECT_URL =
'https://localhost:8443/serviceworker/resources/redirect.php?ACAOrigin=*&Redirect=';
-['same-origin', 'cors', 'no-cors'].forEach(function(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, 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);
- }
- });
- });
- }, 'Block fetch() as mixed content (' + mode + ')');
- });
+testBlockMixedContent('same-origin');
+testBlockMixedContent('cors');
done();

Powered by Google App Engine
This is Rietveld 408576698