Index: tests/html/xhr_test.dart |
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart |
index 10df44a6fa83212b901f126764c982e02505514d..3a71d7df508e7cd37deb3c982fff76c51f298f2b 100644 |
--- a/tests/html/xhr_test.dart |
+++ b/tests/html/xhr_test.dart |
@@ -8,6 +8,12 @@ import '../../pkg/unittest/lib/html_individual_config.dart'; |
import 'dart:html'; |
import 'dart:json' as json; |
+void fail(message) { |
+ guardAsync(() { |
+ expect(false, isTrue, reason: message); |
+ }); |
+} |
+ |
main() { |
useHtmlIndividualConfiguration(); |
var url = "/tests/html/xhr_cross_origin_data.txt"; |
@@ -87,6 +93,30 @@ main() { |
})); |
}); |
+ test('XHR.getString file', () { |
+ HttpRequest.getString(url).then(expectAsync1((str) {})); |
+ }); |
+ |
+ test('XHR.getString No file', () { |
+ HttpRequest.getString('NonExistingFile').then( |
+ (_) { fail('Succeeded for non-existing file.'); }, |
+ onError: expectAsync1((e) { |
+ validate404(e.error.target); |
+ })); |
+ }); |
+ |
+ test('XHR.request', () { |
+ if (ArrayBuffer.supported) { |
+ HttpRequest.request(url, responseType: 'ArrayBuffer').then( |
+ expectAsync1((xhr) { |
+ validate200Response(xhr); |
+ var arrayBuffer = xhr.response; |
+ expect(arrayBuffer, new isInstanceOf<ArrayBuffer>()); |
+ expect(arrayBuffer, isNotNull); |
+ })); |
+ } |
+ }); |
+ |
test('HttpRequestProgressEvent', () { |
var expectation = HttpRequestProgressEvent.supported ? |
returnsNormally : throws; |