OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library XHRTest; | 5 library XHRTest; |
6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:json' as json; | 10 import 'dart:json' as json; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 test('XHR.getString No file', () { | 138 test('XHR.getString No file', () { |
139 HttpRequest.getString('NonExistingFile').then( | 139 HttpRequest.getString('NonExistingFile').then( |
140 (_) { fail('Succeeded for non-existing file.'); }, | 140 (_) { fail('Succeeded for non-existing file.'); }, |
141 onError: expectAsync1((error) { | 141 onError: expectAsync1((error) { |
142 validate404(error.target); | 142 validate404(error.target); |
143 })); | 143 })); |
144 }); | 144 }); |
145 | 145 |
146 test('XHR.request responseType arraybuffer', () { | 146 test('XHR.request responseType arraybuffer', () { |
147 if (Platform.supportsTypedData) { | 147 if (Platform.supportsTypedData) { |
148 HttpRequest.request(url, responseType: 'arraybuffer').then( | 148 HttpRequest.request(url, responseType: 'arraybuffer', |
| 149 mimeType: 'application/binary', |
| 150 requestHeaders: {'Content-Type': 'text/xml'}).then( |
149 expectAsync1((xhr) { | 151 expectAsync1((xhr) { |
150 expect(xhr.status, equals(200)); | 152 expect(xhr.status, equals(200)); |
151 var byteBuffer = xhr.response; | 153 var byteBuffer = xhr.response; |
152 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); | 154 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); |
153 expect(byteBuffer, isNotNull); | 155 expect(byteBuffer, isNotNull); |
154 })); | 156 })); |
155 } | 157 } |
156 }); | 158 }); |
157 | 159 |
158 test('HttpRequestProgressEvent', () { | 160 test('HttpRequestProgressEvent', () { |
(...skipping 13 matching lines...) Expand all Loading... |
172 (xhr) { | 174 (xhr) { |
173 expect(xhr.status, equals(200)); | 175 expect(xhr.status, equals(200)); |
174 var blob = xhr.response; | 176 var blob = xhr.response; |
175 expect(blob is Blob, isTrue); | 177 expect(blob is Blob, isTrue); |
176 expect(blob, isNotNull); | 178 expect(blob, isNotNull); |
177 }); | 179 }); |
178 } | 180 } |
179 }); | 181 }); |
180 }); | 182 }); |
181 } | 183 } |
OLD | NEW |