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

Side by Side Diff: tests/html/xhr_test.dart

Issue 13954014: Add Supported class to dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 test('XHR.getString No file', () { 137 test('XHR.getString No file', () {
138 HttpRequest.getString('NonExistingFile').then( 138 HttpRequest.getString('NonExistingFile').then(
139 (_) { fail('Succeeded for non-existing file.'); }, 139 (_) { fail('Succeeded for non-existing file.'); },
140 onError: expectAsync1((error) { 140 onError: expectAsync1((error) {
141 validate404(error.target); 141 validate404(error.target);
142 })); 142 }));
143 }); 143 });
144 144
145 test('XHR.request responseType arraybuffer', () { 145 test('XHR.request responseType arraybuffer', () {
146 if (ArrayBuffer.supported) { 146 if (Supported.typeddata) {
147 HttpRequest.request(url, responseType: 'arraybuffer').then( 147 HttpRequest.request(url, responseType: 'arraybuffer').then(
148 expectAsync1((xhr) { 148 expectAsync1((xhr) {
149 expect(xhr.status, equals(200)); 149 expect(xhr.status, equals(200));
150 var arrayBuffer = xhr.response; 150 var arrayBuffer = xhr.response;
151 expect(arrayBuffer, new isInstanceOf<ArrayBuffer>()); 151 expect(arrayBuffer, new isInstanceOf<ArrayBuffer>());
152 expect(arrayBuffer, isNotNull); 152 expect(arrayBuffer, isNotNull);
153 })); 153 }));
154 } 154 }
155 }); 155 });
156 156
157 test('HttpRequestProgressEvent', () { 157 test('HttpRequestProgressEvent', () {
158 var expectation = HttpRequestProgressEvent.supported ? 158 var expectation = HttpRequestProgressEvent.supported ?
159 returnsNormally : throws; 159 returnsNormally : throws;
160 expect(() { 160 expect(() {
161 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); 161 var event = new Event.eventType('XMLHttpRequestProgressEvent', '');
162 expect(event is HttpRequestProgressEvent, isTrue); 162 expect(event is HttpRequestProgressEvent, isTrue);
163 }, expectation); 163 }, expectation);
164 }); 164 });
165 }); 165 });
166 166
167 group('xhr_requestBlob', () { 167 group('xhr_requestBlob', () {
168 test('XHR.request responseType blob', () { 168 test('XHR.request responseType blob', () {
169 if (ArrayBuffer.supported) { 169 if (Supported.typeddata) {
170 return HttpRequest.request(url, responseType: 'blob').then( 170 return HttpRequest.request(url, responseType: 'blob').then(
171 (xhr) { 171 (xhr) {
172 expect(xhr.status, equals(200)); 172 expect(xhr.status, equals(200));
173 var blob = xhr.response; 173 var blob = xhr.response;
174 expect(blob is Blob, isTrue); 174 expect(blob is Blob, isTrue);
175 expect(blob, isNotNull); 175 expect(blob, isNotNull);
176 }); 176 });
177 } 177 }
178 }); 178 });
179 }); 179 });
180 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698