OLD | NEW |
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 |
11 void fail(message) { | 11 void fail(message) { |
12 guardAsync(() { | 12 guardAsync(() { |
13 expect(false, isTrue, reason: message); | 13 expect(false, isTrue, reason: message); |
14 }); | 14 }); |
15 } | 15 } |
16 | 16 |
17 main() { | 17 main() { |
18 useHtmlIndividualConfiguration(); | 18 useHtmlIndividualConfiguration(); |
19 var url = "/tests/html/xhr_cross_origin_data.txt"; | 19 var url = "/root_dart/tests/html/xhr_cross_origin_data.txt"; |
20 | 20 |
21 void validate200Response(xhr) { | 21 void validate200Response(xhr) { |
22 expect(xhr.status, equals(200)); | 22 expect(xhr.status, equals(200)); |
23 var data = json.parse(xhr.response); | 23 var data = json.parse(xhr.response); |
24 expect(data, contains('feed')); | 24 expect(data, contains('feed')); |
25 expect(data['feed'], contains('entry')); | 25 expect(data['feed'], contains('entry')); |
26 expect(data, isMap); | 26 expect(data, isMap); |
27 } | 27 } |
28 | 28 |
29 void validate404(xhr) { | 29 void validate404(xhr) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 test('HttpRequestProgressEvent', () { | 139 test('HttpRequestProgressEvent', () { |
140 var expectation = HttpRequestProgressEvent.supported ? | 140 var expectation = HttpRequestProgressEvent.supported ? |
141 returnsNormally : throws; | 141 returnsNormally : throws; |
142 expect(() { | 142 expect(() { |
143 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); | 143 var event = new Event.eventType('XMLHttpRequestProgressEvent', ''); |
144 expect(event is HttpRequestProgressEvent, isTrue); | 144 expect(event is HttpRequestProgressEvent, isTrue); |
145 }, expectation); | 145 }, expectation); |
146 }); | 146 }); |
147 }); | 147 }); |
148 } | 148 } |
OLD | NEW |