| <!DOCTYPE html><!-- webkit-test-runner [ isAppInitiated=true ] --> |
| <html> |
| <head> |
| <script src="resources/util.js"></script> |
| </head> |
| <body onload="setTimeout('runTest()', 0)"> |
| <div id="description">Test loadURL requests are succesfully attributed as app initiated.</div> |
| <pre id="console"></pre> |
| <script> |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| } |
| |
| function loadURL() { |
| document.location.href = destinationOrigin + "/app-privacy-report/app-attribution-load-url.html"; |
| } |
| |
| function log(message) { |
| document.getElementById('console').appendChild(document.createTextNode(message + '\n')); |
| } |
| |
| const destinationOrigin = "http://localhost:8000"; |
| const startingOrigin = "http://127.0.0.1:8000"; |
| function runTest() { |
| if (document.location.origin === startingOrigin) { |
| loadURL(); |
| } else { |
| var didLoadAppInitiatedRequest = testRunner.didLoadAppInitiatedRequest(); |
| var didLoadNonAppInitiatedRequest = testRunner.didLoadNonAppInitiatedRequest(); |
| |
| if (didLoadNonAppInitiatedRequest) { |
| log("FAIL did load non app initiated request"); |
| testRunner.notifyDone(); |
| } |
| |
| if (!didLoadAppInitiatedRequest) { |
| log("FAIL did not load app initiated request"); |
| testRunner.notifyDone(); |
| } |
| |
| log("PASS successfully loaded only app initiated requests"); |
| testRunner.notifyDone(); |
| } |
| } |
| </script> |
| </body> |
| </html> |