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

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

Issue 1920873002: Enable error pages for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TEST. Created 4 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
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
index 239527866df758e22a3c11a4cf6d03918d912d10..693c9f3cb265ee2976f15e58b02ce4aacdec8f09 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-frame-resource.html
@@ -71,16 +71,14 @@ async_test(function(t) {
scope + '?mode=no-cors&url=' +
encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path);
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);
- });
+ frame.onload = function () { resolve(frame) };
+ });
})
.then(function(frame) {
- assert_equals(
- frame.contentDocument.body.textContent,
- '',
- 'Opaque type response could not be loaded in the iframe.');
+ assert_throws('SecurityError', _ => {
+ assert_equals(frame.contentDocument.body.textContent, '');
+ }, 'Opaque response renders error page in the iframe.');
frame.remove();
return service_worker_unregister_and_done(t, scope);
})
@@ -145,23 +143,22 @@ async_test(function(t) {
return wait_for_state(t, reg.installing, 'activated');
})
.then(function() {
- var win = window.open(
+ return window.open(
scope + '?mode=no-cors&url=' +
encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path));
- // We can't catch the network error on window. So we use the timer.
- return new Promise(function(resolve) {
- setTimeout(function() { resolve(win); }, 1000);
- });
})
.then(function(win) {
- assert_equals(
- win.document.body.textContent,
- '',
- 'Opaque type response could not be loaded in the new window.');
- win.close();
- return service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
+ // Give the window time to load: we won't get any error or load events
+ // so we'll set a timeout instead:
+ setTimeout(_ => {
+ assert_throws('SecurityError', _ => {
+ assert_equals(win.document.body.textContent, '');
+ }, 'Opaque response renders error page in the new window.');
+ win.close();
+ return service_worker_unregister_and_done(t, scope);
+ }, 1000);
+ })
+// .catch(unreached_rejection(t));
}, 'Opaque type response could not be loaded in the new window.');
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698