Chromium Code Reviews| 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:html'; | 8 import 'dart:html'; |
| 9 import 'dart:json' as json; | 9 import 'dart:json' as json; |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 test('XHR.getString No file', () { | 119 test('XHR.getString No file', () { |
| 120 HttpRequest.getString('NonExistingFile').then( | 120 HttpRequest.getString('NonExistingFile').then( |
| 121 (_) { fail('Succeeded for non-existing file.'); }, | 121 (_) { fail('Succeeded for non-existing file.'); }, |
| 122 onError: expectAsync1((e) { | 122 onError: expectAsync1((e) { |
| 123 validate404(e.error.target); | 123 validate404(e.error.target); |
| 124 })); | 124 })); |
| 125 }); | 125 }); |
| 126 | 126 |
| 127 test('XHR.request responseType', () { | 127 test('XHR.request responseType', () { |
| 128 if (ArrayBuffer.supported) { | 128 if (ArrayBuffer.supported) { |
| 129 HttpRequest.request(url, responseType: 'ArrayBuffer').then( | 129 HttpRequest.request(url, responseType: 'arraybuffer').then( |
|
Emily Fortuna
2013/02/01 00:14:47
lgtm. can you add a comment on the appropriate fun
| |
| 130 expectAsync1((xhr) { | 130 expectAsync1((xhr) { |
| 131 validate200Response(xhr); | 131 expect(xhr.status, equals(200)); |
| 132 var arrayBuffer = xhr.response; | 132 var arrayBuffer = xhr.response; |
| 133 expect(arrayBuffer, new isInstanceOf<ArrayBuffer>()); | 133 expect(arrayBuffer, new isInstanceOf<ArrayBuffer>()); |
| 134 expect(arrayBuffer, isNotNull); | 134 expect(arrayBuffer, isNotNull); |
| 135 })); | 135 })); |
| 136 } | 136 } |
| 137 }); | 137 }); |
| 138 | 138 |
| 139 test('HttpRequestProgressEvent', () { | 139 test('HttpRequestProgressEvent', () { |
| 140 var expectation = HttpRequestProgressEvent.supported ? | 140 var expectation = HttpRequestProgressEvent.supported ? |
| 141 returnsNormally : throws; | 141 returnsNormally : throws; |
| 142 expect(() { | 142 expect(() { |
| 143 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); | 143 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); |
| 144 expect(event is HttpRequestProgressEvent, isTrue); | 144 expect(event is HttpRequestProgressEvent, isTrue); |
| 145 }, expectation); | 145 }, expectation); |
| 146 }); | 146 }); |
| 147 }); | 147 }); |
| 148 } | 148 } |
| OLD | NEW |