| <!DOCTYPE html><!-- webkit-test-runner [ AllowCrossOriginSubresourcesToAskForCredentials=true ] --> |
| <html> |
| <head> |
| <script src=../../media-resources/video-test.js></script> |
| <script src=../../media-resources/media-file.js></script> |
| <script> |
| |
| if (window.testRunner) { |
| testRunner.setHandlesAuthenticationChallenges(true); |
| testRunner.setAuthenticationUsername("username"); |
| testRunner.setAuthenticationPassword("password"); |
| } |
| |
| var tests; |
| var media = findMediaFile('video', 'test'); |
| var type = mimeTypeForExtension(media.split('.').pop()); |
| |
| function startTests() |
| { |
| findMediaElement(); |
| waitForEventAndFail('error'); |
| waitForEvent('canplay', runNextTest); |
| |
| tests = [ |
| testSameDomain, |
| testCrossDomain, |
| ]; |
| |
| runNextTest(); |
| } |
| |
| function runNextTest() |
| { |
| var test = tests.shift(); |
| if (test) |
| test(); |
| else |
| endTest(); |
| } |
| |
| function testSameDomain() |
| { |
| consoleWrite('Testing same domain (127.0.0.1)'); |
| video.src = 'http://127.0.0.1:8000/media/resources/video-auth.py?name=' + media + '&type=' + type; |
| video.load(); |
| } |
| |
| function testCrossDomain() |
| { |
| consoleWrite('Testing cross domain (localhost)'); |
| video.src = 'http://localhost:8000/media/resources/video-auth.py?name=' + media + '&type=' + type; |
| video.load(); |
| } |
| </script> |
| </head> |
| |
| <body onload="startTests()"> |
| <video></video> |
| <br> |
| Tests that the media player sends authorization credentials when requesting a media file. |
| </body> |
| </html> |