| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| description("Tests the behavior of no-referrer-when-downgrade referrer policy when cross origin."); |
| jsTestIsAsync = true; |
| |
| if (window.internals) |
| internals.setResourceLoadStatisticsEnabled(false); |
| |
| if (window.testRunner) { |
| testRunner.setStatisticsShouldDowngradeReferrer(false, function () { |
| // Should be the full URL |
| let expected = "http://127.0.0.1:8000/referrer-policy-img/no-referrer-when-downgrade/cross-origin-http-http.html"; |
| let img = new Image(); |
| img.referrerPolicy = "no-referrer-when-downgrade"; |
| img.onload = function() { testPassed('referrer is "' + expected + '"'); finishJSTest(); } |
| img.onerror = function() { testFailed("referrer is not as expected"); finishJSTest(); } |
| img.src = "http://127.0.0.1:8000/referrer-policy/resources/image.php?expected=" + expected; |
| if (window.internals) |
| internals.setResourceLoadStatisticsEnabled(true); |
| }); |
| } |
| |
| </script> |
| </body> |
| </html> |