| 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((e) { | 141 onError: expectAsync1((e) { |
| 142 validate404(e.error.target); | 142 validate404(e.error.target); |
| 143 })); | 143 })); |
| 144 }); | 144 }); |
| 145 | 145 |
| 146 test('XHR.request responseType bytebuffer', () { | 146 test('XHR.request responseType bytebuffer', () { |
| 147 if (ByteBuffer.supported) { | 147 if (ByteBuffer.supported) { |
| 148 HttpRequest.request(url, responseType: 'bytebuffer').then( | 148 HttpRequest.request(url, responseType: 'arraybuffer').then( |
| 149 expectAsync1((xhr) { | 149 expectAsync1((xhr) { |
| 150 expect(xhr.status, equals(200)); | 150 expect(xhr.status, equals(200)); |
| 151 var byteBuffer = xhr.response; | 151 var byteBuffer = xhr.response; |
| 152 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); | 152 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); |
| 153 expect(byteBuffer, isNotNull); | 153 expect(byteBuffer, isNotNull); |
| 154 })); | 154 })); |
| 155 } | 155 } |
| 156 }); | 156 }); |
| 157 | 157 |
| 158 test('HttpRequestProgressEvent', () { | 158 test('HttpRequestProgressEvent', () { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 172 (xhr) { | 172 (xhr) { |
| 173 expect(xhr.status, equals(200)); | 173 expect(xhr.status, equals(200)); |
| 174 var blob = xhr.response; | 174 var blob = xhr.response; |
| 175 expect(blob is Blob, isTrue); | 175 expect(blob is Blob, isTrue); |
| 176 expect(blob, isNotNull); | 176 expect(blob, isNotNull); |
| 177 }); | 177 }); |
| 178 } | 178 } |
| 179 }); | 179 }); |
| 180 }); | 180 }); |
| 181 } | 181 } |
| OLD | NEW |