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

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

Issue 12088029: Adding test for bug 5374 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « no previous file | no next file » | 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:html'; 8 import 'dart:html';
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 }); 44 });
45 45
46 test('XHR file', () { 46 test('XHR file', () {
47 var xhr = new HttpRequest(); 47 var xhr = new HttpRequest();
48 xhr.open('GET', url, true); 48 xhr.open('GET', url, true);
49 xhr.on.readyStateChange.add(expectAsyncUntil1((e) { 49 xhr.on.readyStateChange.add(expectAsyncUntil1((e) {
50 if (xhr.readyState == HttpRequest.DONE) { 50 if (xhr.readyState == HttpRequest.DONE) {
51 validate200Response(xhr); 51 validate200Response(xhr);
52 } 52 }
53 }, () => xhr.readyState == HttpRequest.DONE)); 53 }, () => xhr.readyState == HttpRequest.DONE));
54
55 xhr.onLoadEnd.listen(expectAsync1((ProgressEvent e) {
56 expect(e.currentTarget, xhr);
57 expect(e.target, xhr);
58 }));
54 xhr.send(); 59 xhr.send();
55 }); 60 });
56 61
57 test('XHR.get No file', () { 62 test('XHR.get No file', () {
58 new HttpRequest.get("NonExistingFile", expectAsync1((xhr) { 63 new HttpRequest.get("NonExistingFile", expectAsync1((xhr) {
59 expect(xhr.readyState, equals(HttpRequest.DONE)); 64 expect(xhr.readyState, equals(HttpRequest.DONE));
60 validate404(xhr); 65 validate404(xhr);
61 })); 66 }));
62 }); 67 });
63 68
(...skipping 21 matching lines...) Expand all
85 test('HttpRequestProgressEvent', () { 90 test('HttpRequestProgressEvent', () {
86 var expectation = HttpRequestProgressEvent.supported ? 91 var expectation = HttpRequestProgressEvent.supported ?
87 returnsNormally : throws; 92 returnsNormally : throws;
88 expect(() { 93 expect(() {
89 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); 94 var event = new Event.eventType('XMLHttpRequestProgressEvent', '');
90 expect(event is HttpRequestProgressEvent, isTrue); 95 expect(event is HttpRequestProgressEvent, isTrue);
91 }, expectation); 96 }, expectation);
92 }); 97 });
93 }); 98 });
94 } 99 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698