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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https.html

Issue 2826573004: fetch-event.https.html: Fix asserts mistakenly outside the promise chain (Closed)
Patch Set: rm flaky expectation Created 3 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script> 2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script> 3 <script src="/resources/testharnessreport.js"></script>
4 <script src="/common/get-host-info.sub.js"></script> 4 <script src="/common/get-host-info.sub.js"></script>
5 <script src="resources/test-helpers.sub.js"></script> 5 <script src="resources/test-helpers.sub.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 var worker = 'resources/fetch-event-test-worker.js'; 8 var worker = 'resources/fetch-event-test-worker.js';
9 9
10 async_test(function(t) { 10 async_test(function(t) {
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 .then(function(frame) { 509 .then(function(frame) {
510 assert_equals( 510 assert_equals(
511 frame.contentDocument.body.textContent, 511 frame.contentDocument.body.textContent,
512 'Fragment Found :' + fragment, 512 'Fragment Found :' + fragment,
513 'Service worker should expose URL fragments in request.'); 513 'Service worker should expose URL fragments in request.');
514 frame.remove(); 514 frame.remove();
515 return service_worker_unregister_and_done(t, scope); 515 return service_worker_unregister_and_done(t, scope);
516 }) 516 })
517 .catch(unreached_rejection(t)); 517 .catch(unreached_rejection(t));
518 }, 'Service Worker should expose FetchEvent URL fragments.'); 518 }, 'Service Worker should expose FetchEvent URL fragments.');
519
519 async_test(function(t) { 520 async_test(function(t) {
520 var scope = 'resources/simple.html?cache'; 521 var scope = 'resources/simple.html?cache';
521 var frame; 522 var frame;
522 var cacheTypes = [ 523 var cacheTypes = [
523 undefined, 'default', 'no-store', 'reload', 'no-cache', 'force-cache', 'on ly-if-cached' 524 undefined, 'default', 'no-store', 'reload', 'no-cache', 'force-cache', 'on ly-if-cached'
524 ]; 525 ];
525 service_worker_unregister_and_register(t, worker, scope) 526 service_worker_unregister_and_register(t, worker, scope)
526 .then(function(reg) { 527 .then(function(reg) {
527 return wait_for_state(t, reg.installing, 'activated'); 528 return wait_for_state(t, reg.installing, 'activated');
528 }) 529 })
(...skipping 13 matching lines...) Expand all
542 .then(function(response) { return response.text(); }) 543 .then(function(response) { return response.text(); })
543 .then(function(response_text) { 544 .then(function(response_text) {
544 var expected = (type === undefined) ? 'default' : type; 545 var expected = (type === undefined) ? 'default' : type;
545 assert_equals(response_text, expected, 546 assert_equals(response_text, expected,
546 'Service Worker should respond to fetch with the correct type'); 547 'Service Worker should respond to fetch with the correct type');
547 }) 548 })
548 .then(resolve) 549 .then(resolve)
549 .catch(reject); 550 .catch(reject);
550 }); 551 });
551 }); 552 });
553 return Promise.all(tests);
552 }) 554 })
553 .then(function() { 555 .then(function() {
554 return new Promise(function(resolve, reject) { 556 return new Promise(function(resolve, reject) {
555 frame.addEventListener('load', function onLoad() { 557 frame.addEventListener('load', function onLoad() {
556 frame.removeEventListener('load', onLoad); 558 frame.removeEventListener('load', onLoad);
557 try { 559 try {
558 assert_equals(frame.contentWindow.document.body.textContent, 560 assert_equals(frame.contentWindow.document.body.textContent,
559 'no-cache'); 561 'no-cache');
560 resolve(); 562 resolve();
561 } catch (e) { 563 } catch (e) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 return frame.contentWindow.fetch(scope, 645 return frame.contentWindow.fetch(scope,
644 {'integrity': integrity_metadata}) 646 {'integrity': integrity_metadata})
645 .then(function(response) { 647 .then(function(response) {
646 return response.text(); 648 return response.text();
647 }) 649 })
648 .then(function(response_text) { 650 .then(function(response_text) {
649 // Should get the same integrity metadata. 651 // Should get the same integrity metadata.
650 assert_equals(response_text, integrity_metadata, 652 assert_equals(response_text, integrity_metadata,
651 'Service Worker should respond to fetch with t he correct integrity'); 653 'Service Worker should respond to fetch with t he correct integrity');
652 }) 654 })
653 .then(resolve()) 655 .then(resolve())
shimazu 2017/04/18 08:57:11 Could you move this to the line before 654? // I g
falken 2017/04/19 04:02:23 Done.
654 .catch(reject()); 656 .catch(reject());
shimazu 2017/04/18 08:57:11 Is no parenthesis necessary here?
falken 2017/04/19 04:02:23 Done.
655 }); 657 });
656 }) 658 })
657 .then(function() { 659 .then(function() {
658 frame.remove(); 660 frame.remove();
659 return service_worker_unregister_and_done(t, scope); 661 return service_worker_unregister_and_done(t, scope);
660 }) 662 })
661 .catch(unreached_rejection(t)); 663 .catch(unreached_rejection(t));
662 }, 'Service Worker responds to fetch event with the correct integrity_metadata '); 664 }, 'Service Worker responds to fetch event with the correct integrity_metadata ');
663 665
664 </script> 666 </script>
665 </body> 667 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698