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

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

Issue 24427003: Removed HttpRequestProgressEvent (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 'dart:async'; 6 import 'dart:async';
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 import 'package:unittest/html_individual_config.dart'; 10 import 'package:unittest/html_individual_config.dart';
(...skipping 19 matching lines...) Expand all
30 expect(data, contains('feed')); 30 expect(data, contains('feed'));
31 expect(data['feed'], contains('entry')); 31 expect(data['feed'], contains('entry'));
32 expect(data, isMap); 32 expect(data, isMap);
33 } 33 }
34 34
35 void validate404(xhr) { 35 void validate404(xhr) {
36 expect(xhr.status, equals(404)); 36 expect(xhr.status, equals(404));
37 expect(xhr.responseText, equals('')); 37 expect(xhr.responseText, equals(''));
38 } 38 }
39 39
40 group('supported_HttpRequestProgressEvent', () {
41 test('supported', () {
42 expect(HttpRequestProgressEvent.supported, isTrue);
43 });
44 });
45
46 group('supported_onProgress', () { 40 group('supported_onProgress', () {
47 test('supported', () { 41 test('supported', () {
48 expect(HttpRequest.supportsProgressEvent, isTrue); 42 expect(HttpRequest.supportsProgressEvent, isTrue);
49 }); 43 });
50 }); 44 });
51 45
52 group('supported_onLoadEnd', () { 46 group('supported_onLoadEnd', () {
53 test('supported', () { 47 test('supported', () {
54 expect(HttpRequest.supportsLoadEndEvent, isTrue); 48 expect(HttpRequest.supportsLoadEndEvent, isTrue);
55 }); 49 });
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 requestHeaders: {'Content-Type': 'text/xml'}).then( 153 requestHeaders: {'Content-Type': 'text/xml'}).then(
160 expectAsync1((xhr) { 154 expectAsync1((xhr) {
161 expect(xhr.status, equals(200)); 155 expect(xhr.status, equals(200));
162 var byteBuffer = xhr.response; 156 var byteBuffer = xhr.response;
163 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); 157 expect(byteBuffer, new isInstanceOf<ByteBuffer>());
164 expect(byteBuffer, isNotNull); 158 expect(byteBuffer, isNotNull);
165 })); 159 }));
166 } 160 }
167 }); 161 });
168 162
169 test('HttpRequestProgressEvent', () {
170 var expectation = HttpRequestProgressEvent.supported ?
171 returnsNormally : throws;
172 expect(() {
173 var event = new Event.eventType('XMLHttpRequestProgressEvent', '');
174 expect(event is HttpRequestProgressEvent, isTrue);
175 }, expectation);
176 });
177
178 test('overrideMimeType', () { 163 test('overrideMimeType', () {
179 var expectation = 164 var expectation =
180 HttpRequest.supportsOverrideMimeType ? returnsNormally : throws; 165 HttpRequest.supportsOverrideMimeType ? returnsNormally : throws;
181 166
182 expect(() { 167 expect(() {
183 HttpRequest.request(url, mimeType: 'application/binary'); 168 HttpRequest.request(url, mimeType: 'application/binary');
184 }, expectation); 169 }, expectation);
185 }); 170 });
186 171
187 if (Platform.supportsTypedData) { 172 if (Platform.supportsTypedData) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 sendData: JSON.encode(data), 240 sendData: JSON.encode(data),
256 responseType: 'json').then( 241 responseType: 'json').then(
257 expectAsync1((xhr) { 242 expectAsync1((xhr) {
258 expect(xhr.status, equals(200)); 243 expect(xhr.status, equals(200));
259 var json = xhr.response; 244 var json = xhr.response;
260 expect(json, equals(data)); 245 expect(json, equals(data));
261 })); 246 }));
262 }); 247 });
263 }); 248 });
264 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698