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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html

Issue 1356353003: Relax cross-origin partial response requirements for CORS presence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert accidental php change. Created 5 years, 2 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/media/mixed-range-response.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html b/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html
index e4fec3688df130dab3a18988851f36688422472c..f3a8c887b87ba153b806cc454f826d897d6ba944 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/mixed-range-response.html
@@ -16,9 +16,11 @@
// If the origin of 2. (mixed-range-response.php) and 6. (load-video.php) are
// different, an error should occur.
-function create_failure_audio_test(url) {
+function create_failure_audio_test(url, crossOrigin) {
return new Promise(function(resolve, reject) {
var audio = document.createElement('audio');
+ if (crossOrigin)
+ audio.crossOrigin = crossOrigin;
audio.oncanplay = function() {
reject('canplay event should not be fired. url: ' + url);
};
@@ -28,9 +30,11 @@ function create_failure_audio_test(url) {
});
}
-function create_success_audio_test(url) {
+function create_success_audio_test(url, crossOrigin) {
return new Promise(function(resolve, reject) {
var audio = document.createElement('audio');
+ if (crossOrigin)
+ audio.crossOrigin = crossOrigin;
audio.oncanplay = resolve;
audio.onerror = function(e) {
reject('error event should not be fired. url: ' + url);
@@ -42,10 +46,75 @@ function create_success_audio_test(url) {
var HOST_INFO = get_host_info();
var MIX_RESPONSE_PHP_PATH = '/media/resources/mixed-range-response.php';
+var REDIRECT_PHP_PATH = '/resources/redirect.php'
var AUDIO_PATH = '/media/resources/load-video.php?' +
'name=../../../../media/content/silence.oga&type=audio/ogg';
promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_ORIGIN'] + AUDIO_PATH));
+ }, 'Redirect from same-origin to same-origin must succeed.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH));
+ }, 'Redirect from same-origin to remote-origin must succeed.');
+
+promise_test(function(t) {
+ return create_failure_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH ,
+ 'anonymous');
+ }, 'CORS-disallowed remote-origin with crossOrigin=anonymous must fail.');
+
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH + '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN'],
+ 'anonymous');
+ }, 'CORS-allowed remote-origin with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_ORIGIN'] + AUDIO_PATH),
+ 'anonymous');
+ }, 'Redirect from same-origin to same-origin with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
+ return create_failure_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH),
+ 'anonymous');
+ }, 'Redirect from same-origin to CORS-disallowed remote-origin with crossOrigin=anonymous must fail.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN']),
+ 'anonymous');
+ }, 'Redirect from same-origin to CORS-allowed remote-origin with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
+ return create_failure_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN']),
+ 'anonymous');
+ }, 'Redirect from CORS-disallowed remote-origin to CORS-allowed remote-origin with crossOrigin=anonymous must fail.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + REDIRECT_PHP_PATH + '?url=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN']) +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN'],
+ 'anonymous');
+ }, 'Redirect from CORS-allowed remote-origin to CORS-allowed remote-origin with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
return create_success_audio_test(
HOST_INFO['HTTP_ORIGIN'] + MIX_RESPONSE_PHP_PATH + '?location=' +
encodeURIComponent(HOST_INFO['HTTP_ORIGIN'] + AUDIO_PATH));
@@ -69,5 +138,29 @@ promise_test(function(t) {
encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH));
}, 'Mixing same remote-origin responses must succeed.');
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + MIX_RESPONSE_PHP_PATH + '?location=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN']) +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN'],
+ 'anonymous');
+ }, 'Mixing same CORS-allowed remote-origin responses with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_ORIGIN'] + MIX_RESPONSE_PHP_PATH + '?location=' +
+ encodeURIComponent(HOST_INFO['HTTP_REMOTE_ORIGIN'] + AUDIO_PATH +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN']),
+ 'anonymous');
+ }, 'Mixing same-origin response and CORS-allowed remote-origin response with crossOrigin=anonymous must succeed.');
+
+promise_test(function(t) {
+ return create_success_audio_test(
+ HOST_INFO['HTTP_REMOTE_ORIGIN'] + MIX_RESPONSE_PHP_PATH + '?location=' +
+ encodeURIComponent(HOST_INFO['HTTP_ORIGIN'] + AUDIO_PATH + '&cors_allow_origin=*') +
+ '&cors_allow_origin=' + HOST_INFO['HTTP_ORIGIN'],
+ 'anonymous');
+ }, 'Mixing CORS-allowed remote-origin response and same-origin response with crossOrigin=anonymous must succeed.');
</script>
</body>
« no previous file with comments | « media/blink/buffered_data_source_unittest.cc ('k') | third_party/WebKit/LayoutTests/http/tests/media/resources/load-video.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698