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

Unified Diff: tests/html/xhr_test.dart

Issue 12087077: Adding ease-of-use methods to HttpRequest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698