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

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

Issue 12380046: Future-ify all the html methods and add named parameters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tests/html/xhr_cross_origin_test.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 group('supported_onLoadEnd', () { 47 group('supported_onLoadEnd', () {
48 test('supported', () { 48 test('supported', () {
49 expect(HttpRequest.supportsLoadEndEvent, isTrue); 49 expect(HttpRequest.supportsLoadEndEvent, isTrue);
50 }); 50 });
51 }); 51 });
52 52
53 group('xhr', () { 53 group('xhr', () {
54 test('XHR No file', () { 54 test('XHR No file', () {
55 HttpRequest xhr = new HttpRequest(); 55 HttpRequest xhr = new HttpRequest();
56 xhr.open("GET", "NonExistingFile", true); 56 xhr.open("GET", "NonExistingFile", async: true);
57 xhr.onReadyStateChange.listen(expectAsyncUntil1((event) { 57 xhr.onReadyStateChange.listen(expectAsyncUntil1((event) {
58 if (xhr.readyState == HttpRequest.DONE) { 58 if (xhr.readyState == HttpRequest.DONE) {
59 validate404(xhr); 59 validate404(xhr);
60 } 60 }
61 }, () => xhr.readyState == HttpRequest.DONE)); 61 }, () => xhr.readyState == HttpRequest.DONE));
62 xhr.send(); 62 xhr.send();
63 }); 63 });
64 64
65 test('XHR file', () { 65 test('XHR file', () {
66 var loadEndCalled = false; 66 var loadEndCalled = false;
67 67
68 var xhr = new HttpRequest(); 68 var xhr = new HttpRequest();
69 xhr.open('GET', url, true); 69 xhr.open('GET', url, async: true);
70 xhr.onReadyStateChange.listen(expectAsyncUntil1((e) { 70 xhr.onReadyStateChange.listen(expectAsyncUntil1((e) {
71 if (xhr.readyState == HttpRequest.DONE) { 71 if (xhr.readyState == HttpRequest.DONE) {
72 validate200Response(xhr); 72 validate200Response(xhr);
73 73
74 Timer.run(expectAsync0(() { 74 Timer.run(expectAsync0(() {
75 expect(loadEndCalled, HttpRequest.supportsLoadEndEvent); 75 expect(loadEndCalled, HttpRequest.supportsLoadEndEvent);
76 })); 76 }));
77 } 77 }
78 }, () => xhr.readyState == HttpRequest.DONE)); 78 }, () => xhr.readyState == HttpRequest.DONE));
79 79
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « tests/html/xhr_cross_origin_test.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698