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

Unified Diff: LayoutTests/http/tests/serviceworker/fetch-frame-resource.html

Issue 1067303002: [ServiceWorker] Treat cors response as a network error for client requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: wrap the line Created 5 years, 8 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
« no previous file with comments | « no previous file | Source/modules/serviceworkers/RespondWithObserver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
diff --git a/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html b/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
index caec13af4bbccbdcdbd51fb563e58219f4ecfb1a..4de0f2f7223b945fc6c514736ffb679b61157ff2 100644
--- a/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
+++ b/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
@@ -42,21 +42,27 @@ async_test(function(t) {
return wait_for_state(t, reg.installing, 'activated');
})
.then(function() {
- return with_iframe(
+ var frame = document.createElement('iframe');
+ frame.src =
scope + '?mode=cors&url=' +
encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path +
- '?ACAOrigin=' + host_info['HTTP_ORIGIN']));
+ '?ACAOrigin=' + host_info['HTTP_ORIGIN']);
+ document.body.appendChild(frame);
+ // We can't catch the network error on iframe. So we use the timer.
+ return new Promise(function(resolve) {
+ setTimeout(function() { resolve(frame); }, 1000);
+ });
})
.then(function(frame) {
- assert_not_equals(
+ assert_equals(
frame.contentDocument.body.textContent,
'',
- 'CORS type response could be loaded in the iframe.');
+ 'CORS type response could not be loaded in the iframe.');
frame.remove();
return service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
- }, 'CORS type response could be loaded in the iframe.');
+ }, 'CORS type response could not be loaded in the iframe.');
async_test(function(t) {
var scope = 'resources/fetch-frame-resource/frame-opaque';
@@ -118,24 +124,25 @@ async_test(function(t) {
return wait_for_state(t, reg.installing, 'activated');
})
.then(function() {
+ var win = window.open(
+ scope + '?mode=cors&url=' +
+ encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path +
+ '?ACAOrigin=' + host_info['HTTP_ORIGIN']));
+ // We can't catch the network error on window. So we use the timer.
return new Promise(function(resolve) {
- var win = window.open(
- scope + '?mode=cors&url=' +
- encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path +
- '?ACAOrigin=' + host_info['HTTP_ORIGIN']));
- win.onload = function() { resolve(win); };
+ setTimeout(function() { resolve(win); }, 1000);
});
})
.then(function(win) {
- assert_not_equals(
+ assert_equals(
win.document.body.textContent,
'',
- 'CORS type response could be loaded in the new window.');
+ 'CORS type response could not be loaded in the new window.');
win.close();
return service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
- }, 'CORS type response could be loaded in the new window.');
+ }, 'CORS type response could not be loaded in the new window.');
async_test(function(t) {
var scope = 'resources/fetch-frame-resource/window-opaque';
@@ -156,7 +163,7 @@ async_test(function(t) {
assert_equals(
win.document.body.textContent,
'',
- 'CORS type response could not be loaded in the new window.');
+ 'Opaque type response could not be loaded in the new window.');
win.close();
return service_worker_unregister_and_done(t, scope);
})
« no previous file with comments | « no previous file | Source/modules/serviceworkers/RespondWithObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698