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

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

Issue 14752025: Adding ability to specify request headers and mime type for Future-based XHRs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 test('XHR.getString No file', () { 138 test('XHR.getString No file', () {
139 HttpRequest.getString('NonExistingFile').then( 139 HttpRequest.getString('NonExistingFile').then(
140 (_) { fail('Succeeded for non-existing file.'); }, 140 (_) { fail('Succeeded for non-existing file.'); },
141 onError: expectAsync1((error) { 141 onError: expectAsync1((error) {
142 validate404(error.target); 142 validate404(error.target);
143 })); 143 }));
144 }); 144 });
145 145
146 test('XHR.request responseType arraybuffer', () { 146 test('XHR.request responseType arraybuffer', () {
147 if (Platform.supportsTypedData) { 147 if (Platform.supportsTypedData) {
148 HttpRequest.request(url, responseType: 'arraybuffer').then( 148 HttpRequest.request(url, responseType: 'arraybuffer',
149 mimeType: 'application/binary',
150 requestHeaders: {'Content-Type': 'text/xml'}).then(
149 expectAsync1((xhr) { 151 expectAsync1((xhr) {
150 expect(xhr.status, equals(200)); 152 expect(xhr.status, equals(200));
151 var byteBuffer = xhr.response; 153 var byteBuffer = xhr.response;
152 expect(byteBuffer, new isInstanceOf<ByteBuffer>()); 154 expect(byteBuffer, new isInstanceOf<ByteBuffer>());
153 expect(byteBuffer, isNotNull); 155 expect(byteBuffer, isNotNull);
154 })); 156 }));
155 } 157 }
156 }); 158 });
157 159
158 test('HttpRequestProgressEvent', () { 160 test('HttpRequestProgressEvent', () {
(...skipping 13 matching lines...) Expand all
172 (xhr) { 174 (xhr) {
173 expect(xhr.status, equals(200)); 175 expect(xhr.status, equals(200));
174 var blob = xhr.response; 176 var blob = xhr.response;
175 expect(blob is Blob, isTrue); 177 expect(blob is Blob, isTrue);
176 expect(blob, isNotNull); 178 expect(blob, isNotNull);
177 }); 179 });
178 } 180 }
179 }); 181 });
180 }); 182 });
181 } 183 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698