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

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

Issue 16376006: Fixing HttpRequest.upload.onProgress. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }); 172 });
173 173
174 test('overrideMimeType', () { 174 test('overrideMimeType', () {
175 var expectation = 175 var expectation =
176 HttpRequest.supportsOverrideMimeType ? returnsNormally : throws; 176 HttpRequest.supportsOverrideMimeType ? returnsNormally : throws;
177 177
178 expect(() { 178 expect(() {
179 HttpRequest.request(url, mimeType: 'application/binary'); 179 HttpRequest.request(url, mimeType: 'application/binary');
180 }, expectation); 180 }, expectation);
181 }); 181 });
182
183 if (Platform.supportsTypedData) {
184 test('xhr upload', () {
185 var xhr = new HttpRequest();
186 var progressCalled = false;
187 xhr.upload.onProgress.listen((e) {
188 progressCalled = true;
189 });
190
191 xhr.open('POST',
192 '${window.location.protocol}//${window.location.host}/echo');
193
194 // 10MB of payload data w/ a bit of data to make sure it
195 // doesn't get compressed to nil.
196 var data = new Uint8List(10 * 1024 * 1024);
197 for (var i = 0; i < data.length; ++i) {
198 data[i] = i & 0xFF;
199 }
200 xhr.send(data);
201
202 return xhr.onLoadEnd.first.then((_) {
203 expect(progressCalled, isTrue);
204 });
205 });
206 }
182 }); 207 });
183 208
184 group('xhr_requestBlob', () { 209 group('xhr_requestBlob', () {
185 test('XHR.request responseType blob', () { 210 test('XHR.request responseType blob', () {
186 if (Platform.supportsTypedData) { 211 if (Platform.supportsTypedData) {
187 return HttpRequest.request(url, responseType: 'blob').then( 212 return HttpRequest.request(url, responseType: 'blob').then(
188 (xhr) { 213 (xhr) {
189 expect(xhr.status, equals(200)); 214 expect(xhr.status, equals(200));
190 var blob = xhr.response; 215 var blob = xhr.response;
191 expect(blob is Blob, isTrue); 216 expect(blob is Blob, isTrue);
192 expect(blob, isNotNull); 217 expect(blob, isNotNull);
193 }); 218 });
194 } 219 }
195 }); 220 });
196 }); 221 });
197 } 222 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698