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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html

Issue 743653002: [ServiceWorker] support OPTIONS request for ServiceWorker [3/3 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « no previous file | Source/core/loader/DocumentThreadableLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script src="../../resources/testharness.js"></script> 1 <script src="../../resources/testharness.js"></script>
2 <script src="test-helpers.js?pipe=sub"></script> 2 <script src="test-helpers.js?pipe=sub"></script>
3 <script> 3 <script>
4 var host_info = get_host_info(); 4 var host_info = get_host_info();
5 5
6 function get_boundary(headers) { 6 function get_boundary(headers) {
7 var reg = new RegExp('multipart\/form-data; boundary=(.*)'); 7 var reg = new RegExp('multipart\/form-data; boundary=(.*)');
8 for (var i = 0; i < headers.length; ++i) { 8 for (var i = 0; i < headers.length; ++i) {
9 if (headers[i][0] != 'content-type') { 9 if (headers[i][0] != 'content-type') {
10 continue; 10 continue;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 function custom_method_test() { 74 function custom_method_test() {
75 return xhr_send(host_info['HTTP_ORIGIN'], 'XXX', 'test string xxx', false) 75 return xhr_send(host_info['HTTP_ORIGIN'], 'XXX', 'test string xxx', false)
76 .then(function(response){ 76 .then(function(response){
77 assert_equals(response.method, 'XXX'); 77 assert_equals(response.method, 'XXX');
78 assert_equals(response.body, 'test string xxx'); 78 assert_equals(response.body, 'test string xxx');
79 }); 79 });
80 } 80 }
81 81
82 function options_method_test() {
83 return xhr_send(host_info['HTTP_ORIGIN'], 'OPTIONS', 'test string xxx', false)
84 .then(function(response){
yhirano 2014/11/21 03:44:51 please add a space after between ')' and '{'
yhirano 2014/11/21 03:51:45 Sorry, I meant please add a space between ')' and
horo 2014/11/21 04:22:49 Done.
85 assert_equals(response.method, 'OPTIONS');
86 assert_equals(response.body, 'test string xxx');
87 });
88 }
89
82 function form_data_test() { 90 function form_data_test() {
83 return create_file_system_file('fsfile.txt', 'fs file content') 91 return create_file_system_file('fsfile.txt', 'fs file content')
84 .then(function(file_system_file) { 92 .then(function(file_system_file) {
85 var formData = new FormData(); 93 var formData = new FormData();
86 formData.append('sample string', '1234567890'); 94 formData.append('sample string', '1234567890');
87 formData.append('sample blob', new Blob(['blob content'])); 95 formData.append('sample blob', new Blob(['blob content']));
88 formData.append('sample file', new File(['file content'], 'file.dat')); 96 formData.append('sample file', new File(['file content'], 'file.dat'));
89 formData.append('sample fs file', file_system_file); 97 formData.append('sample fs file', file_system_file);
90 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', formData, false); 98 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', formData, false);
91 }) 99 })
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }; 162 };
155 xhr.responseType = 'text'; 163 xhr.responseType = 'text';
156 xhr.open('GET', 'data:text/html,Foobar', true); 164 xhr.open('GET', 'data:text/html,Foobar', true);
157 xhr.send(); 165 xhr.send();
158 }) 166 })
159 .then(function(data) { 167 .then(function(data) {
160 assert_equals(data, 'Foobar'); 168 assert_equals(data, 'Foobar');
161 }); 169 });
162 } 170 }
163 171
164 function xhr_options_test() {
165 return new Promise(function(resolve, reject) {
166 var xhr = new XMLHttpRequest();
167 xhr.onload = function() {
168 resolve(xhr.response);
169 };
170 xhr.onerror = function() {
171 reject('XHR should succeed.');
172 };
173 xhr.responseType = 'text';
174 xhr.open('OpTiOnS', 'fetch-access-control.php', true);
175 xhr.send();
176 })
177 .then(function(data) {
178 var result;
179 var report = function(arg) {
180 result = arg;
181 };
182 eval(data);
183 assert_equals(result['jsonpResult'], 'success');
184 assert_equals(result['method'], 'OPTIONS');
185 })
186 }
187
188 window.addEventListener('message', function(evt) { 172 window.addEventListener('message', function(evt) {
189 var port = evt.ports[0]; 173 var port = evt.ports[0];
190 string_test() 174 string_test()
191 .then(blob_test) 175 .then(blob_test)
192 .then(custom_method_test) 176 .then(custom_method_test)
177 .then(options_method_test)
193 .then(form_data_test) 178 .then(form_data_test)
194 .then(mode_credentials_test) 179 .then(mode_credentials_test)
195 .then(data_url_test) 180 .then(data_url_test)
196 .then(xhr_options_test)
197 .then(function() { port.postMessage({results: 'finish'}); }) 181 .then(function() { port.postMessage({results: 'finish'}); })
198 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); 182 .catch(function(e) { port.postMessage({results: 'failure:' + e}); });
199 }); 183 });
200 </script> 184 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/DocumentThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698